From 8fbee21a956895a53b2598833d16f923a38b2c5c Mon Sep 17 00:00:00 2001 From: AKurakin Date: Tue, 5 Sep 2023 12:42:46 +0300 Subject: [PATCH] =?UTF-8?q?clearing-service=20http://jira.mfd.msk:8088/bro?= =?UTF-8?q?wse/CLS-311=20=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=20=D0=B7=D0=B0=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?=20Sdf54?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../spcex/clearing/service/Sdf54Creator.java | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/Sdf54Creator.java b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/Sdf54Creator.java index 64a6253b1..238a5c64a 100644 --- a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/Sdf54Creator.java +++ b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/Sdf54Creator.java @@ -125,11 +125,21 @@ public class Sdf54Creator { sDf54.setC_acc_deb(c_acc_deb); + Account rBnkAccount = accountImdg.getFirstObjectBySQL("companyId=%s and accountType = '%s' and status = '%s'" + .formatted(paymentInstruction.getAddresseeId(), AccountType.Bank.getKey(), Status.Active.getKey())); + BankAccount rBnkAcc = rBnkAccount == null ? null : bankAccountImdg.getFirstObjectBySQL("accountId = %d".formatted(rBnkAccount.getId())); + if (rBnkAcc != null) { + sDf54.setRbankcode(rBnkAcc.getBankIdentificationCode()); + if (rBnkAcc.getCorrespondentAccount() != null && !rBnkAcc.getCorrespondentAccount().equals(c_acc_cred)) { + log.warn("By paymentInstruction[{}] found accountId={} with CorrespondentAccount=\"{}\" not same that c_acc_cred=\"{}\"", paymentInstruction.getId(), rBnkAccount.getId(), + rBnkAcc.getCorrespondentAccount(), c_acc_cred); + } + } sDf54.setC_acc_cred(c_acc_cred); String addresseeSbankName = ""; - if (paymentInstruction.getAddresseeId().equals(1L)) { + if (Sender.One.equalsById(paymentInstruction.getAddresseeId())) { // == 1 addresseeSbankName = paymentInstruction.getAddresseeBankName(); } else { Company company = companyImdg.getSingleObjectByID(paymentInstruction.getAddresseeId()); @@ -145,6 +155,29 @@ public class Sdf54Creator { sDf54::setRbanknam4, sDf54::setRbanknam5); + { + Company company1 = companyImdg.getSingleObjectByID(Sender.One.getId()); + if (company1 != null) { // "АО СПВБ" company.shortName[id = 1] + SpecifUtil.fillSegmentsBy35Symbols(company1.getShortName(), + sDf54::setSclientn1, + sDf54::setSclientn2, + sDf54::setSclientn3, + sDf54::setSclientn4); + } else { + log.warn("Company id=1 not exist"); + } + } + { + Company company = companyImdg.getSingleObjectByID(paymentInstruction.getAddresseeId()); + if (company != null) { + SpecifUtil.fillSegmentsBy35Symbols(company.getShortName(), + sDf54::setRclientn1, + sDf54::setRclientn2, + sDf54::setRclientn3, + sDf54::setRclientn4); + } + } + sDf54.setPay_date(payDateFormatter.format(TimeUtil.toLocalDate(paymentInstruction.getPaymentDate()))); sDf54.setPay_val("RUR"); String sumDeb = paymentInstruction.getDebitLeg_amount() != null ? paymentInstruction.getDebitLeg_amount().toString() : "";