This commit is contained in:
parent
1d4e1b4a3e
commit
7d30f24525
3 changed files with 15 additions and 7 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package ru.spcex.clearing.service.builder;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import ru.clearing.classes.statics.data.account.Account;
|
||||
|
|
@ -42,6 +43,7 @@ public class PaymentInstructionBuilderFinalMkrDeals {
|
|||
protected LocalDate documentNumberResetAt;
|
||||
protected AtomicLong documentNumberId = new AtomicLong(0L); // порядковый номер (сквозной по всем компаниям за день
|
||||
private static final DateTimeFormatter DATE_FORMATTER_ddMMyy = DateTimeFormatter.ofPattern("ddMMyy");
|
||||
private String purpose;
|
||||
|
||||
public static PaymentInstructionBuilderFinalMkrDeals builder(ImdgProvider imdgProvider) {
|
||||
return new PaymentInstructionBuilderFinalMkrDeals(imdgProvider);
|
||||
|
|
@ -79,6 +81,11 @@ public class PaymentInstructionBuilderFinalMkrDeals {
|
|||
return this;
|
||||
}
|
||||
|
||||
public PaymentInstructionBuilderFinalMkrDeals paymentPurpose(String purpose) {
|
||||
this.purpose = purpose;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Pair<PaymentInstruction, PaymentInstruction> build() {
|
||||
|
||||
PaymentInstruction payment1;
|
||||
|
|
@ -121,7 +128,7 @@ public class PaymentInstructionBuilderFinalMkrDeals {
|
|||
|
||||
payment1.setPaymentDate(TimeUtil.localDateToInstant(lm_t.getSettlementDate()));
|
||||
|
||||
payment1.setPaymentPurpose(paymentPurpose(lm_t));
|
||||
payment1.setPaymentPurpose(purpose);
|
||||
|
||||
payment1.setSettlementDate(lm_t.getSettlementDate());
|
||||
|
||||
|
|
@ -181,7 +188,7 @@ public class PaymentInstructionBuilderFinalMkrDeals {
|
|||
}
|
||||
payment2.setAdresseeBic(tranBic);
|
||||
payment2.setPaymentDate(TimeUtil.localDateToInstant(lm_t.getSettlementDate()));
|
||||
payment2.setPaymentPurpose(paymentPurpose(lm_t));
|
||||
payment2.setPaymentPurpose(purpose);
|
||||
payment2.setSettlementDate(lm_t.getSettlementDate());
|
||||
BigDecimal amount = lm_t.getBalance() == null ? null : lm_t.getBalance().abs();
|
||||
payment2.setCreditLeg_amount(amount);
|
||||
|
|
@ -213,11 +220,10 @@ public class PaymentInstructionBuilderFinalMkrDeals {
|
|||
return new Pair<>(payment1, payment2);
|
||||
}
|
||||
|
||||
private static String paymentPurpose(Registry rgs) {
|
||||
return "Размещение депозита " + rgs.getContract() + " по ТКР " + rgs.getTradingClearingRegistry();
|
||||
}
|
||||
|
||||
protected String nextDocumentNumber(Registry rgs, PaymentInstruction paymentInstruction) {
|
||||
if (StringUtils.isEmpty(rgs.getContract())) {
|
||||
return "";
|
||||
}
|
||||
LocalDate nowD = LocalDate.now();
|
||||
if (documentNumberResetAt == null || documentNumberResetAt.isBefore(nowD)) synchronized (this) {
|
||||
long oldNum = documentNumberId.get(); // reset optimistic
|
||||
|
|
|
|||
|
|
@ -192,6 +192,7 @@ public class FormingPaymentInstructionDealsFinalMkr implements ISessionStage {
|
|||
.lm_t(lm_t)
|
||||
.tranAcc(tranAcc)
|
||||
.sessionId(sessionId)
|
||||
.paymentPurpose("Размещение депозита " + lm_t.getContract() + " по ТКР " + lm_t.getTradingClearingRegistry())
|
||||
.build();
|
||||
Pair.forEach(pmtInstrs, pmtInstr -> {
|
||||
paymentInstructionImdg.insert(pmtInstr);
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public class FormingPaymentInstructionSecondaryT0 implements ISessionStage {
|
|||
private Collection<Registry> selectRegistries() {
|
||||
ImdgPredicateBuilder rgsPb = registryImdg.predicateBuilder();
|
||||
RegistryCodeSqlBuilder registryCodeSqlBuilder = RegistryCodeSqlBuilder.getInstance(
|
||||
LM_T, CM_T
|
||||
CS_T, LS_T
|
||||
);
|
||||
ImdgPredicate rgsCodePrdct = rgsPb.and(
|
||||
rgsPb.sql(registryCodeSqlBuilder.build()),
|
||||
|
|
@ -192,6 +192,7 @@ public class FormingPaymentInstructionSecondaryT0 implements ISessionStage {
|
|||
.lm_t(ls_t)
|
||||
.tranAcc(tranAcc)
|
||||
.sessionId(sessionId)
|
||||
.paymentPurpose("")//todo пока неизвестная формулировка
|
||||
.build();
|
||||
Pair.forEach(pmtInstrs, pmtInstr -> {
|
||||
paymentInstructionImdg.insert(pmtInstr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue