http://jira.mfd.msk:8088/browse/CLS-189 PaymentInstructionCreator мелкая правка, добавил логов trace
This commit is contained in:
parent
722b6ff385
commit
687b50d970
1 changed files with 50 additions and 36 deletions
|
|
@ -100,7 +100,7 @@ public class PaymentInstructionCreator {
|
||||||
|
|
||||||
// I
|
// I
|
||||||
if (clearingCategory.contains(ClearingCategory.I)) {
|
if (clearingCategory.contains(ClearingCategory.I)) {
|
||||||
log.debug("By liabilitiesClaimsAssets[{}] create for category I 1 record", liabilitiesClaimsAssets.getId());
|
log.debug("By liabilitiesClaimsAssets[{}] create for category I 2 PaymentInstruction record", liabilitiesClaimsAssets.getId());
|
||||||
PaymentInstruction payment1 = new PaymentInstruction();
|
PaymentInstruction payment1 = new PaymentInstruction();
|
||||||
PaymentInstruction payment2 = new PaymentInstruction();
|
PaymentInstruction payment2 = new PaymentInstruction();
|
||||||
|
|
||||||
|
|
@ -115,13 +115,16 @@ public class PaymentInstructionCreator {
|
||||||
payment2.setSenderId(SPVB_ID); // СПВБ
|
payment2.setSenderId(SPVB_ID); // СПВБ
|
||||||
|
|
||||||
payment1.setAddresseeId(SPVB_ID); // СПВБ
|
payment1.setAddresseeId(SPVB_ID); // СПВБ
|
||||||
String sqlLCA = String.format("securityId = %s and companyId != %s",
|
{
|
||||||
liabilitiesClaimsAssets.getSecurityId(), liabilitiesClaimsAssets.getCompanyId());
|
String sqlLCA = String.format("securityId = %s and companyId != %s",
|
||||||
ExecutionDeposit counterExecutionDeposit = executionDepositImdg.getSingleObjectBySQL(sqlLCA);
|
liabilitiesClaimsAssets.getSecurityId(), liabilitiesClaimsAssets.getCompanyId());
|
||||||
if (counterExecutionDeposit == null) {
|
ExecutionDeposit counterExecutionDeposit = executionDepositImdg.getSingleObjectBySQL(sqlLCA);
|
||||||
log.warn("Counter ExecutionDeposit not found for : {}", sqlLCA);
|
if (counterExecutionDeposit == null) {
|
||||||
} else {
|
log.warn("Counter ExecutionDeposit not found for : {}", sqlLCA);
|
||||||
payment2.setAddresseeId(counterExecutionDeposit.getCompanyId());
|
} else {
|
||||||
|
payment2.setAddresseeId(counterExecutionDeposit.getCompanyId());
|
||||||
|
log.trace("payment2.AddresseeId={} found by: {}", payment2.getAddresseeId(), sqlLCA);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String symbol1 = selectSymbolValue(payment1.getAddresseeId(), CompanySymbol.BIC);
|
String symbol1 = selectSymbolValue(payment1.getAddresseeId(), CompanySymbol.BIC);
|
||||||
|
|
@ -140,7 +143,7 @@ public class PaymentInstructionCreator {
|
||||||
Company companyPRC = companyImdg.getSingleObjectByID(PRC_ID); // 2 "НКО АО ПРЦ"
|
Company companyPRC = companyImdg.getSingleObjectByID(PRC_ID); // 2 "НКО АО ПРЦ"
|
||||||
String companyPRCName = null;
|
String companyPRCName = null;
|
||||||
if (companyPRC == null) {
|
if (companyPRC == null) {
|
||||||
log.warn("Company.id=2 not found");
|
log.warn("Company.id={} not found", PRC_ID);
|
||||||
} else {
|
} else {
|
||||||
companyPRCName = companyPRC.getShortName();
|
companyPRCName = companyPRC.getShortName();
|
||||||
}
|
}
|
||||||
|
|
@ -170,13 +173,14 @@ public class PaymentInstructionCreator {
|
||||||
payment2.setDebitLegAmount(amount);
|
payment2.setDebitLegAmount(amount);
|
||||||
|
|
||||||
payment1.setCreditLegAccountId(liabilitiesClaimsAssets.getAccountId());
|
payment1.setCreditLegAccountId(liabilitiesClaimsAssets.getAccountId());
|
||||||
String accSql = String.format("companyId = %s AND accountType=TRAN AND accountStatus=ACTV AND processingSign=ALWD",
|
{
|
||||||
payment2.getSenderId());
|
Account anotherAcc = selectAccount(payment2.getSenderId(), AccountType.Tran, Status.Active, Allowed.ALLOWED);
|
||||||
Account anotherAcc = accountImdg.getSingleObjectBySQL(accSql);
|
if (anotherAcc == null) {
|
||||||
if (anotherAcc == null) {
|
log.warn("Account not found: companyId = {} AND accountType={} AND accountStatus={} AND processingSign={}",
|
||||||
log.warn("Account not found: {}", accSql);
|
payment2.getSenderId(), AccountType.Tran, Status.Active, Allowed.ALLOWED);
|
||||||
} else {
|
} else {
|
||||||
payment2.setCreditLegAccountId(anotherAcc.getId());
|
payment2.setCreditLegAccountId(anotherAcc.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
payment1.setCreditCsAccount(null);
|
payment1.setCreditCsAccount(null);
|
||||||
|
|
@ -231,7 +235,7 @@ public class PaymentInstructionCreator {
|
||||||
} else {
|
} else {
|
||||||
// V / B
|
// V / B
|
||||||
if (clearingCategory.contains(ClearingCategory.V)) {
|
if (clearingCategory.contains(ClearingCategory.V)) {
|
||||||
log.debug("By liabilitiesClaimsAssets[{}] create for category V 1 record", liabilitiesClaimsAssets.getId());
|
log.debug("By liabilitiesClaimsAssets[{}] create for category V 1 PaymentInstruction record", liabilitiesClaimsAssets.getId());
|
||||||
PaymentInstruction payment1 = new PaymentInstruction();
|
PaymentInstruction payment1 = new PaymentInstruction();
|
||||||
payment1.setId(idGenerator.nextId());
|
payment1.setId(idGenerator.nextId());
|
||||||
payment1.setCreated(now);
|
payment1.setCreated(now);
|
||||||
|
|
@ -239,13 +243,16 @@ public class PaymentInstructionCreator {
|
||||||
|
|
||||||
payment1.setSenderId(SPVB_ID); // СПВБ
|
payment1.setSenderId(SPVB_ID); // СПВБ
|
||||||
|
|
||||||
String sqlLCA = String.format("securityId = %s and companyId != %s",
|
{
|
||||||
liabilitiesClaimsAssets.getSecurityId(), liabilitiesClaimsAssets.getCompanyId());
|
String sqlLCA = String.format("securityId = %s and companyId != %s",
|
||||||
ExecutionDeposit counterExecutionDeposit = executionDepositImdg.getSingleObjectBySQL(sqlLCA);
|
liabilitiesClaimsAssets.getSecurityId(), liabilitiesClaimsAssets.getCompanyId());
|
||||||
if (counterExecutionDeposit == null) {
|
ExecutionDeposit counterExecutionDeposit = executionDepositImdg.getSingleObjectBySQL(sqlLCA);
|
||||||
log.warn("Counter ExecutionDeposit not found for : {}", sqlLCA);
|
if (counterExecutionDeposit == null) {
|
||||||
} else {
|
log.warn("Counter ExecutionDeposit not found for : {}", sqlLCA);
|
||||||
payment1.setAddresseeId(counterExecutionDeposit.getCompanyId());
|
} else {
|
||||||
|
payment1.setAddresseeId(counterExecutionDeposit.getCompanyId());
|
||||||
|
log.trace("payment1.AddresseeId={} found by: {}", payment1.getAddresseeId(), sqlLCA);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String symbol1 = selectSymbolValue(payment1.getAddresseeId(), CompanySymbol.BIC);
|
String symbol1 = selectSymbolValue(payment1.getAddresseeId(), CompanySymbol.BIC);
|
||||||
|
|
@ -258,7 +265,7 @@ public class PaymentInstructionCreator {
|
||||||
Company companyPRC = companyImdg.getSingleObjectByID(PRC_ID); // 2 "НКО АО ПРЦ"
|
Company companyPRC = companyImdg.getSingleObjectByID(PRC_ID); // 2 "НКО АО ПРЦ"
|
||||||
String companyPRCName = null;
|
String companyPRCName = null;
|
||||||
if (companyPRC == null) {
|
if (companyPRC == null) {
|
||||||
log.warn("Company.id=2 not found");
|
log.warn("Company.id={} not found", PRC_ID);
|
||||||
} else {
|
} else {
|
||||||
companyPRCName = companyPRC.getShortName();
|
companyPRCName = companyPRC.getShortName();
|
||||||
}
|
}
|
||||||
|
|
@ -280,11 +287,10 @@ public class PaymentInstructionCreator {
|
||||||
payment1.setDebitLegAmount(amount);
|
payment1.setDebitLegAmount(amount);
|
||||||
|
|
||||||
{
|
{
|
||||||
String accSql = String.format("companyId = %s AND accountType=ANLT AND accountStatus=ACTV AND processingSign=ALWD",
|
Account acc1 = selectAccount(payment1.getSenderId(), AccountType.Anlt, Status.Active, Allowed.ALLOWED);
|
||||||
payment1.getSenderId());
|
|
||||||
Account acc1 = accountImdg.getSingleObjectBySQL(accSql);
|
|
||||||
if (acc1 == null) {
|
if (acc1 == null) {
|
||||||
log.warn("Account not found: {}", accSql);
|
log.warn("Account not found: companyId = {} AND accountType={} AND accountStatus={} AND processingSign={}",
|
||||||
|
payment1.getSenderId(), AccountType.Anlt, Status.Active, Allowed.ALLOWED);
|
||||||
} else {
|
} else {
|
||||||
payment1.setCreditLegAccountId(acc1.getId());
|
payment1.setCreditLegAccountId(acc1.getId());
|
||||||
payment1.setCreditLegAccount(acc1.getAccount());
|
payment1.setCreditLegAccount(acc1.getAccount());
|
||||||
|
|
@ -317,7 +323,7 @@ public class PaymentInstructionCreator {
|
||||||
newPaymentInstructions.add(payment1);
|
newPaymentInstructions.add(payment1);
|
||||||
} else // Для V,B только 1 PaymentInstruction
|
} else // Для V,B только 1 PaymentInstruction
|
||||||
if (clearingCategory.contains(ClearingCategory.B)) {
|
if (clearingCategory.contains(ClearingCategory.B)) {
|
||||||
log.debug("By liabilitiesClaimsAssets[{}] create for category B 1 record", liabilitiesClaimsAssets.getId());
|
log.debug("By liabilitiesClaimsAssets[{}] create for category B 1 PaymentInstruction record", liabilitiesClaimsAssets.getId());
|
||||||
PaymentInstruction payment1 = new PaymentInstruction();
|
PaymentInstruction payment1 = new PaymentInstruction();
|
||||||
payment1.setId(idGenerator.nextId());
|
payment1.setId(idGenerator.nextId());
|
||||||
payment1.setCreated(now);
|
payment1.setCreated(now);
|
||||||
|
|
@ -337,7 +343,7 @@ public class PaymentInstructionCreator {
|
||||||
Company companyPRC = companyImdg.getSingleObjectByID(PRC_ID); // 2 "НКО АО ПРЦ"
|
Company companyPRC = companyImdg.getSingleObjectByID(PRC_ID); // 2 "НКО АО ПРЦ"
|
||||||
String companyPRCName = null;
|
String companyPRCName = null;
|
||||||
if (companyPRC == null) {
|
if (companyPRC == null) {
|
||||||
log.warn("Company.id=2 not found");
|
log.warn("Company.id={} not found", PRC_ID);
|
||||||
} else {
|
} else {
|
||||||
companyPRCName = companyPRC.getShortName();
|
companyPRCName = companyPRC.getShortName();
|
||||||
}
|
}
|
||||||
|
|
@ -359,11 +365,10 @@ public class PaymentInstructionCreator {
|
||||||
payment1.setDebitLegAmount(amount);
|
payment1.setDebitLegAmount(amount);
|
||||||
|
|
||||||
{
|
{
|
||||||
String accSql = String.format("companyId = %s AND accountType=ANLT AND accountStatus=ACTV AND processingSign=ALWD",
|
Long accountId = liabilitiesClaimsAssets.getAccountId();
|
||||||
payment1.getSenderId());
|
Account acc1 = accountImdg.getSingleObjectByID(accountId);
|
||||||
Account acc1 = accountImdg.getSingleObjectBySQL(accSql);
|
|
||||||
if (acc1 == null) {
|
if (acc1 == null) {
|
||||||
log.warn("Account not found: {}", accSql);
|
log.warn("Account not found: {}", accountId);
|
||||||
} else {
|
} else {
|
||||||
payment1.setCreditLegAccountId(acc1.getId());
|
payment1.setCreditLegAccountId(acc1.getId());
|
||||||
payment1.setCreditLegAccount(acc1.getAccount());
|
payment1.setCreditLegAccount(acc1.getAccount());
|
||||||
|
|
@ -443,6 +448,15 @@ public class PaymentInstructionCreator {
|
||||||
"accountStatus", accountStatus.getKey(),
|
"accountStatus", accountStatus.getKey(),
|
||||||
"processingSign", processingSign.getKey()
|
"processingSign", processingSign.getKey()
|
||||||
));
|
));
|
||||||
|
if (account == null) {
|
||||||
|
log.trace("Account not found by: companyId={} accountType={} accountStatus={} processingSign={}",
|
||||||
|
companyId, accountType.getKey(), accountStatus.getKey(), processingSign.getKey()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
log.trace("Found Account.id={} by: companyId={} accountType={} accountStatus={} processingSign={}", account.getId(),
|
||||||
|
companyId, accountType.getKey(), accountStatus.getKey(), processingSign.getKey()
|
||||||
|
);
|
||||||
|
}
|
||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -495,7 +509,7 @@ public class PaymentInstructionCreator {
|
||||||
* Обновление liabilitiesClaimsMoney первой/второй ноги по liabilitiesClaimsAssets
|
* Обновление liabilitiesClaimsMoney первой/второй ноги по liabilitiesClaimsAssets
|
||||||
*
|
*
|
||||||
* @param liabilitiesClaimsMoney обновить этот объект (firstLeg)
|
* @param liabilitiesClaimsMoney обновить этот объект (firstLeg)
|
||||||
* @param isFirstLeg true - первая, false вторая
|
* @param isFirstLeg true - первая, false вторая
|
||||||
* @param paymentInstructions
|
* @param paymentInstructions
|
||||||
* @param clearingCategory
|
* @param clearingCategory
|
||||||
* @return были внесены изменения в liabilitiesClaimsMoney
|
* @return были внесены изменения в liabilitiesClaimsMoney
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue