securitySymbol
This commit is contained in:
parent
6ea0cf3e38
commit
06c37e11be
9 changed files with 113 additions and 63 deletions
|
|
@ -75,9 +75,16 @@ public class RegistryManager {
|
||||||
return Optional.ofNullable(dmt);
|
return Optional.ofNullable(dmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<Registry> findRelatedAsset(Long tradingClearingRegistryId, Long companyId, RegistryTradingParams rgsCode) {
|
public Optional<Registry> findRelatedAsset(Long tradingClearingRegistryId,
|
||||||
|
Long companyId,
|
||||||
|
String securitySymbol,
|
||||||
|
RegistryTradingParams rgsCode) {
|
||||||
ImdgPredicate prdct = RegistryAssetPredicate
|
ImdgPredicate prdct = RegistryAssetPredicate
|
||||||
.instance(tradingClearingRegistryId, companyId, rgsCode)
|
.instance(tradingClearingRegistryId,
|
||||||
|
companyId,
|
||||||
|
securitySymbol,
|
||||||
|
rgsCode
|
||||||
|
)
|
||||||
.apply(rgsImdg);
|
.apply(rgsImdg);
|
||||||
return Optional.ofNullable(rgsImdg.getSingleObjectByPredicate(prdct));
|
return Optional.ofNullable(rgsImdg.getSingleObjectByPredicate(prdct));
|
||||||
}
|
}
|
||||||
|
|
@ -104,8 +111,8 @@ public class RegistryManager {
|
||||||
ImdgPredicate rgstrPredicate = pb.and(pb.sql(sql),
|
ImdgPredicate rgstrPredicate = pb.and(pb.sql(sql),
|
||||||
pb.sql(sql),
|
pb.sql(sql),
|
||||||
pb.equals("companyId", companyId),
|
pb.equals("companyId", companyId),
|
||||||
pb.equals("accountId", accountId)
|
pb.equals("accountId", accountId),
|
||||||
|
pb.equals("securitySymbol", registry.getSecuritySymbol())
|
||||||
);
|
);
|
||||||
if (RegistryDesignation.D.equalsByKey(registry.getRegistryDesignation()) && !TextUtil.isEmpty(contract)) {
|
if (RegistryDesignation.D.equalsByKey(registry.getRegistryDesignation()) && !TextUtil.isEmpty(contract)) {
|
||||||
rgstrPredicate = pb.and(rgstrPredicate, pb.equals("contract", contract));
|
rgstrPredicate = pb.and(rgstrPredicate, pb.equals("contract", contract));
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,9 @@ public class PrimaryAuctionBnSession extends AbstractSession implements Initiali
|
||||||
private final InclusionObligations inclusionObligations;
|
private final InclusionObligations inclusionObligations;
|
||||||
private final InspectionObligations inspectionObligations;
|
private final InspectionObligations inspectionObligations;
|
||||||
private final FormingRegistersOnOS formingRegistersOnOS;
|
private final FormingRegistersOnOS formingRegistersOnOS;
|
||||||
private final FormingPaymentInstruction formingPaymentInstruction;
|
private final FormingPaymentInstructionAssets formingPaymentInstructionAssets;
|
||||||
private final FormingPaymentInstructionDealsFinalMkr formingPaymentInstructionDealsFinalMkr;
|
// private final FormingPaymentInstruction formingPaymentInstruction;
|
||||||
|
// private final FormingPaymentInstructionDealsFinalMkr formingPaymentInstructionDealsFinalMkr;
|
||||||
private final UnlockResources unlockResources;
|
private final UnlockResources unlockResources;
|
||||||
private final FinishingSession finishingSession;
|
private final FinishingSession finishingSession;
|
||||||
private final EndStageNotification endStageNotification;
|
private final EndStageNotification endStageNotification;
|
||||||
|
|
@ -57,9 +58,9 @@ public class PrimaryAuctionBnSession extends AbstractSession implements Initiali
|
||||||
ObligationAdmission obligationsAdmission,
|
ObligationAdmission obligationsAdmission,
|
||||||
InclusionObligations inclusionObligations,
|
InclusionObligations inclusionObligations,
|
||||||
FormingRegistersOnOS formingRegistersOnOS,
|
FormingRegistersOnOS formingRegistersOnOS,
|
||||||
FormingPaymentInstruction formingPaymentInstruction,
|
// FormingPaymentInstruction formingPaymentInstruction,
|
||||||
FormingPaymentInstructionDealsFinalMkr formingPaymentInstructionDealsFinalMkr,
|
// FormingPaymentInstructionDealsFinalMkr formingPaymentInstructionDealsFinalMkr,
|
||||||
UnlockResources unlockResources,
|
FormingPaymentInstructionAssets formingPaymentInstructionAssets, UnlockResources unlockResources,
|
||||||
FinishingSession finishingSession,
|
FinishingSession finishingSession,
|
||||||
EndStageNotification endStageNotification,
|
EndStageNotification endStageNotification,
|
||||||
IMessageResolver messageResolver,
|
IMessageResolver messageResolver,
|
||||||
|
|
@ -72,13 +73,14 @@ public class PrimaryAuctionBnSession extends AbstractSession implements Initiali
|
||||||
this.obligationsAdmission = obligationsAdmission;
|
this.obligationsAdmission = obligationsAdmission;
|
||||||
this.inclusionObligations = inclusionObligations;
|
this.inclusionObligations = inclusionObligations;
|
||||||
this.formingRegistersOnOS = formingRegistersOnOS;
|
this.formingRegistersOnOS = formingRegistersOnOS;
|
||||||
this.formingPaymentInstruction = formingPaymentInstruction;
|
this.formingPaymentInstructionAssets = formingPaymentInstructionAssets;
|
||||||
|
// this.formingPaymentInstruction = formingPaymentInstruction;
|
||||||
this.unlockResources = unlockResources;
|
this.unlockResources = unlockResources;
|
||||||
this.finishingSession = finishingSession;
|
this.finishingSession = finishingSession;
|
||||||
this.endStageNotification = endStageNotification;
|
this.endStageNotification = endStageNotification;
|
||||||
this.executionFondImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_ExecutionFond, ExecutionFond.class);
|
this.executionFondImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_ExecutionFond, ExecutionFond.class);
|
||||||
this.inspectionObligations = inspectionObligations;
|
this.inspectionObligations = inspectionObligations;
|
||||||
this.formingPaymentInstructionDealsFinalMkr = formingPaymentInstructionDealsFinalMkr;
|
// this.formingPaymentInstructionDealsFinalMkr = formingPaymentInstructionDealsFinalMkr;
|
||||||
this.marketCodes = marketCodes;
|
this.marketCodes = marketCodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -149,6 +151,7 @@ public class PrimaryAuctionBnSession extends AbstractSession implements Initiali
|
||||||
{
|
{
|
||||||
InspectionPoolPayload companyIdPayload = new InspectionPoolPayload();
|
InspectionPoolPayload companyIdPayload = new InspectionPoolPayload();
|
||||||
companyIdPayload.setProcessedCompanyId(currSession.getCompanyId());
|
companyIdPayload.setProcessedCompanyId(currSession.getCompanyId());
|
||||||
|
companyIdPayload.setSessionId(currSession.getId());
|
||||||
runStage(TaskType.InspectionObligations, companyIdPayload, inspectionObligations);
|
runStage(TaskType.InspectionObligations, companyIdPayload, inspectionObligations);
|
||||||
}
|
}
|
||||||
//stage 6
|
//stage 6
|
||||||
|
|
@ -157,23 +160,24 @@ public class PrimaryAuctionBnSession extends AbstractSession implements Initiali
|
||||||
payload.setSessionId(currSession.getId());
|
payload.setSessionId(currSession.getId());
|
||||||
runStage(TaskType.FormingRegistersOnOS, payload, formingRegistersOnOS); //returns Collection<Registry>
|
runStage(TaskType.FormingRegistersOnOS, payload, formingRegistersOnOS); //returns Collection<Registry>
|
||||||
}
|
}
|
||||||
StageResult<Collection<PaymentInstruction>> returnsPayment = null;
|
//stage 7
|
||||||
|
StageResult<Collection<PaymentInstruction>> paymentResult = null;
|
||||||
{
|
{
|
||||||
FormingPaymentInstructionPayload payload = new FormingPaymentInstructionPayload();
|
FormingPaymentInstructionPayload payload = new FormingPaymentInstructionPayload();
|
||||||
payload.setSessionId(currSession.getId());
|
payload.setSessionId(currSession.getId());
|
||||||
//stage 7
|
//stage 7
|
||||||
returnsPayment = runStage(TaskType.FormingPaymentInstruction, payload, formingPaymentInstruction);
|
paymentResult = runStage(TaskType.FormingPaymentInstruction, payload, formingPaymentInstructionAssets);
|
||||||
}
|
}
|
||||||
//stage 7
|
//stage 7
|
||||||
StageResult<Collection<PaymentInstruction>> paymentResult = null;
|
// StageResult<Collection<PaymentInstruction>> paymentResult = null;
|
||||||
{
|
// {
|
||||||
FormingPaymentInstructionDealsMkrPayload payload = new FormingPaymentInstructionDealsMkrPayload();
|
// FormingPaymentInstructionDealsMkrPayload payload = new FormingPaymentInstructionDealsMkrPayload();
|
||||||
payload.setSessionId(currSession.getId());
|
// payload.setSessionId(currSession.getId());
|
||||||
payload.setSection(section());
|
// payload.setSection(section());
|
||||||
payload.setPaymentInstructionReturns(returnsPayment.getStageResult());
|
// payload.setPaymentInstructionReturns(returnsPayment.getStageResult());
|
||||||
|
//
|
||||||
paymentResult = runStage(TaskType.FormingPaymentInstruction, payload, formingPaymentInstructionDealsFinalMkr);
|
// paymentResult = runStage(TaskType.FormingPaymentInstruction, payload, formingPaymentInstructionDealsFinalMkr);
|
||||||
}
|
// }
|
||||||
if (paymentResult != null && paymentResult.getStageResult().isEmpty()) {
|
if (paymentResult != null && paymentResult.getStageResult().isEmpty()) {
|
||||||
runStage(TaskType.FormingPaymentInstruction, balanceRevise);
|
runStage(TaskType.FormingPaymentInstruction, balanceRevise);
|
||||||
// finishPart(req);
|
// finishPart(req);
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,9 @@ public class PrimaryAuctionT0Session extends AbstractSession implements Initiali
|
||||||
private final InclusionObligations inclusionObligations;
|
private final InclusionObligations inclusionObligations;
|
||||||
private final InspectionObligations inspectionObligations;
|
private final InspectionObligations inspectionObligations;
|
||||||
private final FormingRegistersOnOS formingRegistersOnOS;
|
private final FormingRegistersOnOS formingRegistersOnOS;
|
||||||
private final FormingPaymentInstruction formingPaymentInstruction;
|
private final FormingPaymentInstructionAssets formingPaymentInstructionAssets;
|
||||||
private final FormingPaymentInstructionDealsFinalMkr formingPaymentInstructionDealsFinalMkr;
|
// private final FormingPaymentInstruction formingPaymentInstruction;
|
||||||
|
// private final FormingPaymentInstructionDealsFinalMkr formingPaymentInstructionDealsFinalMkr;
|
||||||
private final UnlockResources unlockResources;
|
private final UnlockResources unlockResources;
|
||||||
private final FinishingSession finishingSession;
|
private final FinishingSession finishingSession;
|
||||||
private final EndStageNotification endStageNotification;
|
private final EndStageNotification endStageNotification;
|
||||||
|
|
@ -56,8 +57,9 @@ public class PrimaryAuctionT0Session extends AbstractSession implements Initiali
|
||||||
ObligationAdmission obligationsAdmission,
|
ObligationAdmission obligationsAdmission,
|
||||||
InclusionObligations inclusionObligations,
|
InclusionObligations inclusionObligations,
|
||||||
FormingRegistersOnOS formingRegistersOnOS,
|
FormingRegistersOnOS formingRegistersOnOS,
|
||||||
FormingPaymentInstruction formingPaymentInstruction,
|
FormingPaymentInstructionAssets formingPaymentInstructionAssets,
|
||||||
FormingPaymentInstructionDealsFinalMkr formingPaymentInstructionDealsFinalMkr,
|
// FormingPaymentInstruction formingPaymentInstruction,
|
||||||
|
// FormingPaymentInstructionDealsFinalMkr formingPaymentInstructionDealsFinalMkr,
|
||||||
UnlockResources unlockResources,
|
UnlockResources unlockResources,
|
||||||
FinishingSession finishingSession,
|
FinishingSession finishingSession,
|
||||||
EndStageNotification endStageNotification,
|
EndStageNotification endStageNotification,
|
||||||
|
|
@ -71,13 +73,14 @@ public class PrimaryAuctionT0Session extends AbstractSession implements Initiali
|
||||||
this.obligationsAdmission = obligationsAdmission;
|
this.obligationsAdmission = obligationsAdmission;
|
||||||
this.inclusionObligations = inclusionObligations;
|
this.inclusionObligations = inclusionObligations;
|
||||||
this.formingRegistersOnOS = formingRegistersOnOS;
|
this.formingRegistersOnOS = formingRegistersOnOS;
|
||||||
this.formingPaymentInstruction = formingPaymentInstruction;
|
this.formingPaymentInstructionAssets = formingPaymentInstructionAssets;
|
||||||
|
// this.formingPaymentInstruction = formingPaymentInstruction;
|
||||||
this.unlockResources = unlockResources;
|
this.unlockResources = unlockResources;
|
||||||
this.finishingSession = finishingSession;
|
this.finishingSession = finishingSession;
|
||||||
this.endStageNotification = endStageNotification;
|
this.endStageNotification = endStageNotification;
|
||||||
this.executionFondImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_ExecutionFond, ExecutionFond.class);
|
this.executionFondImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_ExecutionFond, ExecutionFond.class);
|
||||||
this.inspectionObligations = inspectionObligations;
|
this.inspectionObligations = inspectionObligations;
|
||||||
this.formingPaymentInstructionDealsFinalMkr = formingPaymentInstructionDealsFinalMkr;
|
// this.formingPaymentInstructionDealsFinalMkr = formingPaymentInstructionDealsFinalMkr;
|
||||||
this.marketCodes = marketCodes;
|
this.marketCodes = marketCodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,6 +151,7 @@ public class PrimaryAuctionT0Session extends AbstractSession implements Initiali
|
||||||
{
|
{
|
||||||
InspectionPoolPayload companyIdPayload = new InspectionPoolPayload();
|
InspectionPoolPayload companyIdPayload = new InspectionPoolPayload();
|
||||||
companyIdPayload.setProcessedCompanyId(currSession.getCompanyId());
|
companyIdPayload.setProcessedCompanyId(currSession.getCompanyId());
|
||||||
|
companyIdPayload.setSessionId(currSession.getId());
|
||||||
runStage(TaskType.InspectionObligations, companyIdPayload, inspectionObligations);
|
runStage(TaskType.InspectionObligations, companyIdPayload, inspectionObligations);
|
||||||
}
|
}
|
||||||
//stage 6
|
//stage 6
|
||||||
|
|
@ -156,23 +160,23 @@ public class PrimaryAuctionT0Session extends AbstractSession implements Initiali
|
||||||
payload.setSessionId(currSession.getId());
|
payload.setSessionId(currSession.getId());
|
||||||
runStage(TaskType.FormingRegistersOnOS, payload, formingRegistersOnOS); //returns Collection<Registry>
|
runStage(TaskType.FormingRegistersOnOS, payload, formingRegistersOnOS); //returns Collection<Registry>
|
||||||
}
|
}
|
||||||
StageResult<Collection<PaymentInstruction>> returnsPayment = null;
|
StageResult<Collection<PaymentInstruction>> paymentResult = null;
|
||||||
{
|
{
|
||||||
FormingPaymentInstructionPayload payload = new FormingPaymentInstructionPayload();
|
FormingPaymentInstructionPayload payload = new FormingPaymentInstructionPayload();
|
||||||
payload.setSessionId(currSession.getId());
|
payload.setSessionId(currSession.getId());
|
||||||
//stage 7
|
//stage 7
|
||||||
returnsPayment = runStage(TaskType.FormingPaymentInstruction, payload, formingPaymentInstruction);
|
paymentResult = runStage(TaskType.FormingPaymentInstruction, payload, formingPaymentInstructionAssets);
|
||||||
}
|
}
|
||||||
//stage 7
|
//stage 7
|
||||||
StageResult<Collection<PaymentInstruction>> paymentResult = null;
|
// StageResult<Collection<PaymentInstruction>> paymentResult = null;
|
||||||
{
|
// {
|
||||||
FormingPaymentInstructionDealsMkrPayload payload = new FormingPaymentInstructionDealsMkrPayload();
|
// FormingPaymentInstructionDealsMkrPayload payload = new FormingPaymentInstructionDealsMkrPayload();
|
||||||
payload.setSessionId(currSession.getId());
|
// payload.setSessionId(currSession.getId());
|
||||||
payload.setSection(section());
|
// payload.setSection(section());
|
||||||
payload.setPaymentInstructionReturns(returnsPayment.getStageResult());
|
// payload.setPaymentInstructionReturns(returnsPayment.getStageResult());
|
||||||
|
//
|
||||||
paymentResult = runStage(TaskType.FormingPaymentInstruction, payload, formingPaymentInstructionDealsFinalMkr);
|
// paymentResult = runStage(TaskType.FormingPaymentInstruction, payload, formingPaymentInstructionDealsFinalMkr);
|
||||||
}
|
// }
|
||||||
if (paymentResult != null && paymentResult.getStageResult().isEmpty()) {
|
if (paymentResult != null && paymentResult.getStageResult().isEmpty()) {
|
||||||
runStage(TaskType.FormingPaymentInstruction, balanceRevise);
|
runStage(TaskType.FormingPaymentInstruction, balanceRevise);
|
||||||
// finishPart(req);
|
// finishPart(req);
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||||
import ru.spcex.platform.imdg.api.predicate.specific.RegistryCodeSqlBuilder;
|
import ru.spcex.platform.imdg.api.predicate.specific.RegistryCodeSqlBuilder;
|
||||||
|
import ru.spcex.platform.imdg.api.predicate.specific.SecuritySelector;
|
||||||
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||||
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
||||||
import ru.spcex.platform.utils.enumeration.IMessageResolver;
|
import ru.spcex.platform.utils.enumeration.IMessageResolver;
|
||||||
|
|
@ -63,6 +64,7 @@ public class FormingPaymentInstructionAssets implements ISessionStage {
|
||||||
private final Sdf03Creator sdf03Creator;
|
private final Sdf03Creator sdf03Creator;
|
||||||
private KafkaSender kafkaSender;
|
private KafkaSender kafkaSender;
|
||||||
private final IMessageResolver msgResolver = new SimpleMessageResolver();
|
private final IMessageResolver msgResolver = new SimpleMessageResolver();
|
||||||
|
private final SecuritySelector<Security> securitySelector;
|
||||||
private final RegistryManager rgsMng;
|
private final RegistryManager rgsMng;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -80,6 +82,7 @@ public class FormingPaymentInstructionAssets implements ISessionStage {
|
||||||
this.sDf12Imdg = imdgProvider.getImdg(IMDGDistributedNames.Map_SDf12, SDf12.class);
|
this.sDf12Imdg = imdgProvider.getImdg(IMDGDistributedNames.Map_SDf12, SDf12.class);
|
||||||
this.paymentInstructionImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_PaymentInstruction, PaymentInstruction.class);
|
this.paymentInstructionImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_PaymentInstruction, PaymentInstruction.class);
|
||||||
this.rgsMng = rgsMng;
|
this.rgsMng = rgsMng;
|
||||||
|
this.securitySelector = new SecuritySelector<>(imdgProvider, Security.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -163,7 +166,11 @@ public class FormingPaymentInstructionAssets implements ISessionStage {
|
||||||
debitLegAccount = tranAcc;
|
debitLegAccount = tranAcc;
|
||||||
creditLegAccount = counterAcc;
|
creditLegAccount = counterAcc;
|
||||||
amount = registry.getBalance() == null ? null : registry.getBalance().abs();
|
amount = registry.getBalance() == null ? null : registry.getBalance().abs();
|
||||||
Optional<Registry> payerAmtO = rgsMng.findRelatedAsset(registry.getTradingClearingRegistryId(), registry.getCompanyId(), AM_T);
|
Optional<Registry> payerAmtO = rgsMng.findRelatedAsset(
|
||||||
|
registry.getTradingClearingRegistryId(),
|
||||||
|
registry.getCompanyId(),
|
||||||
|
registry.getSecuritySymbol(),
|
||||||
|
AM_T);
|
||||||
payerAmtO.ifPresent(amt -> {
|
payerAmtO.ifPresent(amt -> {
|
||||||
amt.setSettledDebit(safeBD(amt.getSettledDebit()).add(safeBD(registry.getBalance().abs())));
|
amt.setSettledDebit(safeBD(amt.getSettledDebit()).add(safeBD(registry.getBalance().abs())));
|
||||||
setUpdatedStoreInImdg(amt, now);
|
setUpdatedStoreInImdg(amt, now);
|
||||||
|
|
@ -174,7 +181,12 @@ public class FormingPaymentInstructionAssets implements ISessionStage {
|
||||||
debitLegAccount = counterAcc;
|
debitLegAccount = counterAcc;
|
||||||
creditLegAccount = tranAcc;
|
creditLegAccount = tranAcc;
|
||||||
amount = registry.getBalance() == null ? null : registry.getBalance().abs();
|
amount = registry.getBalance() == null ? null : registry.getBalance().abs();
|
||||||
Optional<Registry> payerAmtO = rgsMng.findRelatedAsset(registry.getTradingClearingRegistryId(), registry.getCompanyId(), AM_T);
|
Optional<Registry> payerAmtO = rgsMng.findRelatedAsset(
|
||||||
|
registry.getTradingClearingRegistryId(),
|
||||||
|
registry.getCompanyId(),
|
||||||
|
registry.getSecuritySymbol(),
|
||||||
|
AM_T
|
||||||
|
);
|
||||||
payerAmtO.ifPresent(amt -> {
|
payerAmtO.ifPresent(amt -> {
|
||||||
amt.setSettledCredit(safeBD(amt.getSettledCredit()).add(safeBD(registry.getBalance().abs())));
|
amt.setSettledCredit(safeBD(amt.getSettledCredit()).add(safeBD(registry.getBalance().abs())));
|
||||||
setUpdatedStoreInImdg(amt, now);
|
setUpdatedStoreInImdg(amt, now);
|
||||||
|
|
@ -223,7 +235,12 @@ public class FormingPaymentInstructionAssets implements ISessionStage {
|
||||||
debitLegAccount = dtrnAcc;
|
debitLegAccount = dtrnAcc;
|
||||||
creditLegAccount = counterAcc;
|
creditLegAccount = counterAcc;
|
||||||
amount = registry.getBalance() == null ? null : registry.getBalance().abs();
|
amount = registry.getBalance() == null ? null : registry.getBalance().abs();
|
||||||
Optional<Registry> payerAstO = rgsMng.findRelatedAsset(registry.getTradingClearingRegistryId(), registry.getCompanyId(), AS_T);
|
Optional<Registry> payerAstO = rgsMng.findRelatedAsset(
|
||||||
|
registry.getTradingClearingRegistryId(),
|
||||||
|
registry.getCompanyId(),
|
||||||
|
registry.getSecuritySymbol(),
|
||||||
|
AS_T
|
||||||
|
);
|
||||||
payerAstO.ifPresent(amt -> {
|
payerAstO.ifPresent(amt -> {
|
||||||
amt.setSettledDebit(safeBD(amt.getSettledDebit()).add(safeBD(registry.getBalance().abs())));
|
amt.setSettledDebit(safeBD(amt.getSettledDebit()).add(safeBD(registry.getBalance().abs())));
|
||||||
setUpdatedStoreInImdg(amt, now);
|
setUpdatedStoreInImdg(amt, now);
|
||||||
|
|
@ -234,7 +251,12 @@ public class FormingPaymentInstructionAssets implements ISessionStage {
|
||||||
debitLegAccount = counterAcc;
|
debitLegAccount = counterAcc;
|
||||||
creditLegAccount = dtrnAcc;
|
creditLegAccount = dtrnAcc;
|
||||||
amount = registry.getBalance() == null ? null : registry.getBalance().abs();
|
amount = registry.getBalance() == null ? null : registry.getBalance().abs();
|
||||||
Optional<Registry> payerAstO = rgsMng.findRelatedAsset(registry.getTradingClearingRegistryId(), registry.getCompanyId(), AS_T);
|
Optional<Registry> payerAstO = rgsMng.findRelatedAsset(
|
||||||
|
registry.getTradingClearingRegistryId(),
|
||||||
|
registry.getCompanyId(),
|
||||||
|
registry.getSecuritySymbol(),
|
||||||
|
AS_T
|
||||||
|
);
|
||||||
payerAstO.ifPresent(amt -> {
|
payerAstO.ifPresent(amt -> {
|
||||||
amt.setSettledCredit(safeBD(amt.getSettledCredit()).add(safeBD(registry.getBalance().abs())));
|
amt.setSettledCredit(safeBD(amt.getSettledCredit()).add(safeBD(registry.getBalance().abs())));
|
||||||
setUpdatedStoreInImdg(amt, now);
|
setUpdatedStoreInImdg(amt, now);
|
||||||
|
|
@ -332,7 +354,10 @@ public class FormingPaymentInstructionAssets implements ISessionStage {
|
||||||
sDf12.setOutDocument(sDf12.getId().toString());
|
sDf12.setOutDocument(sDf12.getId().toString());
|
||||||
sDf12.setDirection("DELFREE");
|
sDf12.setDirection("DELFREE");
|
||||||
sDf12.setQuantity(BigDecimalUtil.limitDecimalPlaces(paymentInstruction.getCreditLeg_amount().toString(), 2));
|
sDf12.setQuantity(BigDecimalUtil.limitDecimalPlaces(paymentInstruction.getCreditLeg_amount().toString(), 2));
|
||||||
sDf12.setSecurityCode(paymentInstruction.getCreditLeg_securityId().toString());
|
Security security = securitySelector.selectSecurityById(paymentInstruction.getCreditLeg_securityId());
|
||||||
|
if (security != null) {
|
||||||
|
sDf12.setSecurityCode(security.getSecuritySymbol());
|
||||||
|
}
|
||||||
sDf12.setDepoCodeSender(paymentInstruction.getCreditLeg_account());
|
sDf12.setDepoCodeSender(paymentInstruction.getCreditLeg_account());
|
||||||
sDf12.setDepoCodeAdressee(paymentInstruction.getDebitLeg_account());
|
sDf12.setDepoCodeAdressee(paymentInstruction.getDebitLeg_account());
|
||||||
// sDf12.setTransactionNumber();
|
// sDf12.setTransactionNumber();
|
||||||
|
|
|
||||||
|
|
@ -153,10 +153,10 @@ public class FormingPaymentInstructionDepositReturn implements ISessionStage {
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
//изменение активов - блокируем средства беред отправкой sdf'ов
|
//изменение активов - блокируем средства беред отправкой sdf'ов
|
||||||
Optional<Registry> amfO = rgsMng.findRelatedAsset(lm_t.getTradingClearingRegistryId(), lm_t.getCompanyId(), AM_F);
|
Optional<Registry> amfO = rgsMng.findRelatedAsset(lm_t.getTradingClearingRegistryId(), lm_t.getCompanyId(), lm_t.getSecuritySymbol(), AM_F);
|
||||||
Optional<Registry> payerAmtO = rgsMng.findRelatedAsset(lm_t.getTradingClearingRegistryId(), lm_t.getCompanyId(), AM_T);
|
Optional<Registry> payerAmtO = rgsMng.findRelatedAsset(lm_t.getTradingClearingRegistryId(), lm_t.getCompanyId(), lm_t.getSecuritySymbol(), AM_T);
|
||||||
Optional<Registry> ambO = rgsMng.findRelatedAsset(lm_t.getTradingClearingRegistryId(), lm_t.getCompanyId(), AM_B);
|
Optional<Registry> ambO = rgsMng.findRelatedAsset(lm_t.getTradingClearingRegistryId(), lm_t.getCompanyId(), lm_t.getSecuritySymbol(), AM_B);
|
||||||
Optional<Registry> receiverAmtO = rgsMng.findRelatedAsset(cm_t.getTradingClearingRegistryId(), cm_t.getCompanyId(), AM_B);
|
Optional<Registry> receiverAmtO = rgsMng.findRelatedAsset(cm_t.getTradingClearingRegistryId(), cm_t.getCompanyId(), lm_t.getSecuritySymbol(), AM_B);
|
||||||
log.debug("changing A* registers based on LM_T.id={} and CM_T.id={} found AM*F.id={}, AM*T.id={}, AM*B.id={}, AM*B.id={}",
|
log.debug("changing A* registers based on LM_T.id={} and CM_T.id={} found AM*F.id={}, AM*T.id={}, AM*B.id={}, AM*B.id={}",
|
||||||
lm_t.getId(),
|
lm_t.getId(),
|
||||||
cm_t.getId(),
|
cm_t.getId(),
|
||||||
|
|
|
||||||
|
|
@ -159,10 +159,10 @@ public class FormingPaymentInstructionReturnMkr implements ISessionStage {
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
//изменение активов - блокируем средства беред отправкой sdf'ов
|
//изменение активов - блокируем средства беред отправкой sdf'ов
|
||||||
Optional<Registry> amfO = rgsMng.findRelatedAsset(lm_t.getTradingClearingRegistryId(), lm_t.getCompanyId(), AM_F);
|
Optional<Registry> amfO = rgsMng.findRelatedAsset(lm_t.getTradingClearingRegistryId(), lm_t.getCompanyId(), lm_t.getSecuritySymbol(), AM_F);
|
||||||
Optional<Registry> payerAmtO = rgsMng.findRelatedAsset(lm_t.getTradingClearingRegistryId(), lm_t.getCompanyId(), AM_T);
|
Optional<Registry> payerAmtO = rgsMng.findRelatedAsset(lm_t.getTradingClearingRegistryId(), lm_t.getCompanyId(), lm_t.getSecuritySymbol(), AM_T);
|
||||||
Optional<Registry> ambO = rgsMng.findRelatedAsset(lm_t.getTradingClearingRegistryId(), lm_t.getCompanyId(), AM_B);
|
Optional<Registry> ambO = rgsMng.findRelatedAsset(lm_t.getTradingClearingRegistryId(), lm_t.getCompanyId(), lm_t.getSecuritySymbol(), AM_B);
|
||||||
Optional<Registry> receiverAmtO = rgsMng.findRelatedAsset(cm_t.getTradingClearingRegistryId(), cm_t.getCompanyId(), AM_B);
|
Optional<Registry> receiverAmtO = rgsMng.findRelatedAsset(cm_t.getTradingClearingRegistryId(), cm_t.getCompanyId(), lm_t.getSecuritySymbol(), AM_B);
|
||||||
log.debug("changing A* registers based on LM_T.id={} and CM_T.id={} found AM*F.id={}, AM*T.id={}, AM*B.id={}, AM*B.id={}",
|
log.debug("changing A* registers based on LM_T.id={} and CM_T.id={} found AM*F.id={}, AM*T.id={}, AM*B.id={}, AM*B.id={}",
|
||||||
lm_t.getId(),
|
lm_t.getId(),
|
||||||
cm_t.getId(),
|
cm_t.getId(),
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||||
import ru.spcex.platform.imdg.api.predicate.specific.RegistryCodeSqlBuilder;
|
import ru.spcex.platform.imdg.api.predicate.specific.RegistryCodeSqlBuilder;
|
||||||
|
import ru.spcex.platform.imdg.api.predicate.specific.SecuritySelector;
|
||||||
import ru.spcex.platform.utils.collection.Pair;
|
import ru.spcex.platform.utils.collection.Pair;
|
||||||
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||||
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
||||||
|
|
@ -68,6 +69,7 @@ public class FormingPaymentInstructionSecondaryT0 implements ISessionStage {
|
||||||
private final Sdf03Creator sdf03Creator;
|
private final Sdf03Creator sdf03Creator;
|
||||||
private final IMessageResolver msgResolver = new SimpleMessageResolver();
|
private final IMessageResolver msgResolver = new SimpleMessageResolver();
|
||||||
private final RegistryManager rgsMng;
|
private final RegistryManager rgsMng;
|
||||||
|
private final SecuritySelector<Security> securitySelector;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public FormingPaymentInstructionSecondaryT0(ImdgProvider imdgProvider,
|
public FormingPaymentInstructionSecondaryT0(ImdgProvider imdgProvider,
|
||||||
|
|
@ -84,6 +86,7 @@ public class FormingPaymentInstructionSecondaryT0 implements ISessionStage {
|
||||||
this.paymentInstructionImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_PaymentInstruction, PaymentInstruction.class);
|
this.paymentInstructionImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_PaymentInstruction, PaymentInstruction.class);
|
||||||
this.sdf03Creator = sdf03Creator;
|
this.sdf03Creator = sdf03Creator;
|
||||||
this.rgsMng = rgsMng;
|
this.rgsMng = rgsMng;
|
||||||
|
this.securitySelector = new SecuritySelector<>(imdgProvider, Security.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -156,10 +159,10 @@ public class FormingPaymentInstructionSecondaryT0 implements ISessionStage {
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
//изменение активов - блокируем средства беред отправкой sdf'ов
|
//изменение активов - блокируем средства беред отправкой sdf'ов
|
||||||
Optional<Registry> amfO = rgsMng.findRelatedAsset(ls_t.getTradingClearingRegistryId(), ls_t.getCompanyId(), AS_F);
|
Optional<Registry> amfO = rgsMng.findRelatedAsset(ls_t.getTradingClearingRegistryId(), ls_t.getCompanyId(), ls_t.getSecuritySymbol(), AS_F);
|
||||||
Optional<Registry> payerAmtO = rgsMng.findRelatedAsset(ls_t.getTradingClearingRegistryId(), ls_t.getCompanyId(), AS_T);
|
Optional<Registry> payerAmtO = rgsMng.findRelatedAsset(ls_t.getTradingClearingRegistryId(), ls_t.getCompanyId(), ls_t.getSecuritySymbol(), AS_T);
|
||||||
Optional<Registry> ambO = rgsMng.findRelatedAsset(ls_t.getTradingClearingRegistryId(), ls_t.getCompanyId(), AS_B);
|
Optional<Registry> ambO = rgsMng.findRelatedAsset(ls_t.getTradingClearingRegistryId(), ls_t.getCompanyId(), ls_t.getSecuritySymbol(), AS_B);
|
||||||
Optional<Registry> receiverAmtO = rgsMng.findRelatedAsset(cs_t.getTradingClearingRegistryId(), cs_t.getCompanyId(), AS_B);
|
Optional<Registry> receiverAmtO = rgsMng.findRelatedAsset(cs_t.getTradingClearingRegistryId(), cs_t.getCompanyId(), ls_t.getSecuritySymbol(), AS_B);
|
||||||
log.debug("changing A* registers based on LM_T.id={} and CM_T.id={} found AM*F.id={}, AM*T.id={}, AM*B.id={}, AM*B.id={}",
|
log.debug("changing A* registers based on LM_T.id={} and CM_T.id={} found AM*F.id={}, AM*T.id={}, AM*B.id={}, AM*B.id={}",
|
||||||
ls_t.getId(),
|
ls_t.getId(),
|
||||||
cs_t.getId(),
|
cs_t.getId(),
|
||||||
|
|
@ -286,7 +289,10 @@ public class FormingPaymentInstructionSecondaryT0 implements ISessionStage {
|
||||||
sDf12.setOutDocument(sDf12.getId().toString());
|
sDf12.setOutDocument(sDf12.getId().toString());
|
||||||
sDf12.setDirection("DELFREE");
|
sDf12.setDirection("DELFREE");
|
||||||
sDf12.setQuantity(BigDecimalUtil.limitDecimalPlaces(paymentInstruction.getCreditLeg_amount().toString(), 2));
|
sDf12.setQuantity(BigDecimalUtil.limitDecimalPlaces(paymentInstruction.getCreditLeg_amount().toString(), 2));
|
||||||
sDf12.setSecurityCode(paymentInstruction.getCreditLeg_securityId().toString());
|
Security security = securitySelector.selectSecurityById(paymentInstruction.getCreditLeg_securityId());
|
||||||
|
if (security != null) {
|
||||||
|
sDf12.setSecurityCode(security.getSecuritySymbol());
|
||||||
|
}
|
||||||
sDf12.setDepoCodeSender(paymentInstruction.getCreditLeg_account());
|
sDf12.setDepoCodeSender(paymentInstruction.getCreditLeg_account());
|
||||||
sDf12.setDepoCodeAdressee(paymentInstruction.getDebitLeg_account());
|
sDf12.setDepoCodeAdressee(paymentInstruction.getDebitLeg_account());
|
||||||
// sDf12.setTransactionNumber();
|
// sDf12.setTransactionNumber();
|
||||||
|
|
|
||||||
|
|
@ -173,13 +173,14 @@ public class InspectionObligations implements ISessionStage {
|
||||||
RegistryUnit.F);
|
RegistryUnit.F);
|
||||||
}
|
}
|
||||||
|
|
||||||
String sqlCounterRegistryCondition = String.format("%s and " +
|
return String.format("%s and " +
|
||||||
"tradingClearingRegistryId = '%s' and " +
|
"tradingClearingRegistryId = '%s' and " +
|
||||||
"companyId = '%s'",
|
"securitySymbol = '%s' and " +
|
||||||
|
"companyId = %d",
|
||||||
RegistryCodeSqlBuilder.getInstance(counterRegistryTradingParams).build(),
|
RegistryCodeSqlBuilder.getInstance(counterRegistryTradingParams).build(),
|
||||||
obligation.getTradingClearingRegistryId(),
|
obligation.getTradingClearingRegistryId(),
|
||||||
|
obligation.getSecuritySymbol(),
|
||||||
obligation.getCompanyId());
|
obligation.getCompanyId());
|
||||||
return sqlCounterRegistryCondition;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String searchMoneyBAssetsSql(Registry obligation) {
|
private String searchMoneyBAssetsSql(Registry obligation) {
|
||||||
|
|
@ -197,10 +198,12 @@ public class InspectionObligations implements ISessionStage {
|
||||||
return String.format("%s and " +
|
return String.format("%s and " +
|
||||||
"tradingClearingRegistryId = '%s' and " +
|
"tradingClearingRegistryId = '%s' and " +
|
||||||
"companyId = '%s' and " +
|
"companyId = '%s' and " +
|
||||||
|
"securitySymbol = '%s' and " +
|
||||||
"accountId = %s",
|
"accountId = %s",
|
||||||
RegistryCodeSqlBuilder.getInstance(AS_B).build(),
|
RegistryCodeSqlBuilder.getInstance(AS_B).build(),
|
||||||
registry.getTradingClearingRegistryId(),
|
registry.getTradingClearingRegistryId(),
|
||||||
registry.getCompanyId(),
|
registry.getCompanyId(),
|
||||||
|
registry.getSecuritySymbol(),
|
||||||
registry.getAccountId());
|
registry.getAccountId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@ import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||||
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
public record RegistryAssetPredicate(Long tcrId, Long companyId, RegistryTradingParams rgsCode) implements Function<Imdg<?>, ImdgPredicate> {
|
public record RegistryAssetPredicate(Long tcrId, Long companyId, String securitySymbol, RegistryTradingParams rgsCode) implements Function<Imdg<?>, ImdgPredicate> {
|
||||||
|
|
||||||
public static RegistryAssetPredicate instance(Long tcrId, Long companyId, RegistryTradingParams rgsCode) {
|
public static RegistryAssetPredicate instance(Long tcrId, Long companyId, String securitySymbol, RegistryTradingParams rgsCode) {
|
||||||
return new RegistryAssetPredicate(tcrId, companyId, rgsCode);
|
return new RegistryAssetPredicate(tcrId, companyId, securitySymbol, rgsCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -21,6 +21,7 @@ public record RegistryAssetPredicate(Long tcrId, Long companyId, RegistryTrading
|
||||||
return rgsPrdBldr.and(
|
return rgsPrdBldr.and(
|
||||||
rgsPrdBldr.equals("tradingClearingRegistryId", tcrId),
|
rgsPrdBldr.equals("tradingClearingRegistryId", tcrId),
|
||||||
rgsPrdBldr.equals("companyId", companyId),
|
rgsPrdBldr.equals("companyId", companyId),
|
||||||
|
rgsPrdBldr.equals("securitySymbol", securitySymbol),
|
||||||
rgsPrdBldr.sql(codeSql.build())
|
rgsPrdBldr.sql(codeSql.build())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue