sdf54 поля SCLIENTN1, INN_DEB, KPP_DEB

This commit is contained in:
ialbert 2024-10-18 16:04:20 +03:00
parent 301ffed9d6
commit 54b0f08050
2 changed files with 22 additions and 9 deletions

View file

@ -68,6 +68,9 @@ public class Sdf54Creator {
Status.Active.getKey(),
pmt.getCreditLeg_currencyCode()
));
if (anltAcc == null) {
throw new IllegalStateException("couldn't fill acc_deb - no ANLT account for " + pmt.getCreditLeg_currencyCode());
}
// c_acc_deb = c_acc_deb == null ? paymentInstruction.getCreditLeg_account() : c_acc_deb;
c_acc_cred = c_acc_cred == null ? pmt.getDebitLeg_account() : c_acc_cred;
@ -77,6 +80,9 @@ public class Sdf54Creator {
sDf54.setId(idGenerator.nextId());
sDf54.setSeg_type("V");
Long debCompanyId = anltAcc.getCompanyId();
sDf54.setAcc_deb(anltAcc.getAccount());
//**********************
String tranBic = selectSymbolValue(Sender.Prc.getId(), CompanySymbol.BIC);
if (tranBic == null) {
@ -103,22 +109,19 @@ public class Sdf54Creator {
sDf54::setSbanknam5);
sDf54.setOp_type("01");
sDf54.setOp_order("5");
String innDeb = selectSymbolValue(Sender.One.getId(), CompanySymbol.INN);
String innDeb = selectSymbolValue(debCompanyId, CompanySymbol.INN);
if (innDeb == null) {
log.warn("CompanySymbols INN not found for companyId={}", Sender.One.getId());
log.warn("CompanySymbols INN not found for companyId={}", debCompanyId);
} else {
sDf54.setInn_deb(innDeb);
}
String kppDeb = selectSymbolValue(Sender.One.getId(), CompanySymbol.CPP);
String kppDeb = selectSymbolValue(debCompanyId, CompanySymbol.CPP);
if (kppDeb == null) {
log.warn("CompanySymbols CPP not found for companyId={}", Sender.One.getId());
log.warn("CompanySymbols CPP not found for companyId={}", debCompanyId);
} else {
sDf54.setKpp_deb(kppDeb);
}
if (anltAcc != null) {
sDf54.setAcc_deb(anltAcc.getAccount());
}
Account accDebAcc = accountImdg.getSingleObjectByID(pmt.getDebitLeg_accountId());
if (accDebAcc == null || !AccountStatus.ACTIVE.equalsByKey(accDebAcc.getStatus())) {
log.warn("paymentInstruction[{}].DebitLeg_accountId={} account not exist or not active.", pmt.getId(), pmt.getDebitLeg_accountId());
@ -177,7 +180,7 @@ public class Sdf54Creator {
sDf54.setC_acc_cred(c_acc_cred);
{
Company company1 = companyImdg.getSingleObjectByID(Sender.One.getId());
Company company1 = companyImdg.getSingleObjectByID(debCompanyId);
if (company1 != null) { // "АО СПВБ" company.shortName[id = 1]
String sclientn;
if (LocaleUtil.isRus(locale)) {

View file

@ -56,6 +56,7 @@ import ru.spcex.platform.utils.enumeration.EnumMessage;
import ru.spcex.platform.utils.enumeration.IEnumId;
import ru.spcex.platform.utils.enumeration.IMessageResolver;
import ru.spcex.platform.utils.localization.SpringPropertiesLocalizer;
import ru.spcex.platform.utils.log.ExceptionUtils;
import static ru.spcex.platform.utils.number.BigDecimalUtil.safeBD;
import ru.spcex.platform.utils.text.TextUtil;
import ru.spcex.platform.utils.validation.IValidator;
@ -195,7 +196,16 @@ public class PaymentInstructionOutboundService {
}
log.debug("assets found and balance is ok. am*b.id={}, am*t.id={}, am*f.id={}",
assets.get().a__b().getId(), assets.get().a__t().getId(), assets.get().a__f().getId());
SDf54 sDf54 = sdf54Creator.create(pmt);
SDf54 sDf54 = null;
try {
sDf54 = sdf54Creator.create(pmt);
} catch (IllegalStateException e) {
log.error(ExceptionUtils.getStackTrace(e));
pmt.setTransactionStatus(TransactionStatus.fail.getKey());
pmt.setUpdated(now);
pmtImdg.update(pmt);
return error(req.getId(), ClearingError.GeneralError);
}
sDf54.setId(idGenerator.nextId());
sDf54.setGenerationId(pmt.getId());
if (time.isTradingTime()) {