http://jira.mfd.msk:8088/browse/CLS-730 messaging to bankAccount kafka's topic added

This commit is contained in:
Ivan Nikolaev-Axenov 2024-09-11 15:35:05 +03:00
parent f95541fa79
commit dc23b32141
3 changed files with 346 additions and 2 deletions

View file

@ -0,0 +1,295 @@
package ru.spcex.clearing.xml.importer.logic.data.kafka;
import java.util.Objects;
public class BankAccountNewAction {
private String bankIdentificationCode;
private String bankName;
private String correspondentAccount;
private String correspondentAccountName;
private String currency;
private String destination;
private String taxpayerIdentificationNumber;
private String taxRegistrationReasonCode;
private String account;
private Long companyId;
private String swiftCode;
private String intermediarySwiftCode;
private String name;
private String address;
private String bankAddress;
private String bankSwiftCode;
private String bankAccount;
private String bankName1;
private String bankAddress1;
private String bankAccount1;
private String bankName2;
private String bankAddress2;
private String intermediarySwiftCode2;
private String bankAccount2;
private String personalAccount;
private String budgetClassificationCode;
private String oktmo;
public String getBankIdentificationCode() {
return bankIdentificationCode;
}
public void setBankIdentificationCode(String bankIdentificationCode) {
this.bankIdentificationCode = bankIdentificationCode;
}
public String getBankName() {
return bankName;
}
public void setBankName(String bankName) {
this.bankName = bankName;
}
public String getCorrespondentAccount() {
return correspondentAccount;
}
public void setCorrespondentAccount(String correspondentAccount) {
this.correspondentAccount = correspondentAccount;
}
public String getCorrespondentAccountName() {
return correspondentAccountName;
}
public void setCorrespondentAccountName(String correspondentAccountName) {
this.correspondentAccountName = correspondentAccountName;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public String getDestination() {
return destination;
}
public void setDestination(String destination) {
this.destination = destination;
}
public String getTaxpayerIdentificationNumber() {
return taxpayerIdentificationNumber;
}
public void setTaxpayerIdentificationNumber(String taxpayerIdentificationNumber) {
this.taxpayerIdentificationNumber = taxpayerIdentificationNumber;
}
public String getTaxRegistrationReasonCode() {
return taxRegistrationReasonCode;
}
public void setTaxRegistrationReasonCode(String taxRegistrationReasonCode) {
this.taxRegistrationReasonCode = taxRegistrationReasonCode;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public Long getCompanyId() {
return companyId;
}
public void setCompanyId(Long companyId) {
this.companyId = companyId;
}
public String getSwiftCode() {
return swiftCode;
}
public void setSwiftCode(String swiftCode) {
this.swiftCode = swiftCode;
}
public String getIntermediarySwiftCode() {
return intermediarySwiftCode;
}
public void setIntermediarySwiftCode(String intermediarySwiftCode) {
this.intermediarySwiftCode = intermediarySwiftCode;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getBankAddress() {
return bankAddress;
}
public void setBankAddress(String bankAddress) {
this.bankAddress = bankAddress;
}
public String getBankSwiftCode() {
return bankSwiftCode;
}
public void setBankSwiftCode(String bankSwiftCode) {
this.bankSwiftCode = bankSwiftCode;
}
public String getBankAccount() {
return bankAccount;
}
public void setBankAccount(String bankAccount) {
this.bankAccount = bankAccount;
}
public String getBankName1() {
return bankName1;
}
public void setBankName1(String bankName1) {
this.bankName1 = bankName1;
}
public String getBankAddress1() {
return bankAddress1;
}
public void setBankAddress1(String bankAddress1) {
this.bankAddress1 = bankAddress1;
}
public String getBankAccount1() {
return bankAccount1;
}
public void setBankAccount1(String bankAccount1) {
this.bankAccount1 = bankAccount1;
}
public String getBankName2() {
return bankName2;
}
public void setBankName2(String bankName2) {
this.bankName2 = bankName2;
}
public String getBankAddress2() {
return bankAddress2;
}
public void setBankAddress2(String bankAddress2) {
this.bankAddress2 = bankAddress2;
}
public String getIntermediarySwiftCode2() {
return intermediarySwiftCode2;
}
public void setIntermediarySwiftCode2(String intermediarySwiftCode2) {
this.intermediarySwiftCode2 = intermediarySwiftCode2;
}
public String getBankAccount2() {
return bankAccount2;
}
public void setBankAccount2(String bankAccount2) {
this.bankAccount2 = bankAccount2;
}
public String getPersonalAccount() {
return personalAccount;
}
public void setPersonalAccount(String personalAccount) {
this.personalAccount = personalAccount;
}
public String getBudgetClassificationCode() {
return budgetClassificationCode;
}
public void setBudgetClassificationCode(String budgetClassificationCode) {
this.budgetClassificationCode = budgetClassificationCode;
}
public String getOktmo() {
return oktmo;
}
public void setOktmo(String oktmo) {
this.oktmo = oktmo;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BankAccountNewAction that = (BankAccountNewAction) o;
return Objects.equals(bankIdentificationCode, that.bankIdentificationCode) && Objects.equals(bankName, that.bankName) && Objects.equals(correspondentAccount, that.correspondentAccount) && Objects.equals(correspondentAccountName, that.correspondentAccountName) && Objects.equals(currency, that.currency) && Objects.equals(destination, that.destination) && Objects.equals(taxpayerIdentificationNumber, that.taxpayerIdentificationNumber) && Objects.equals(taxRegistrationReasonCode, that.taxRegistrationReasonCode) && Objects.equals(account, that.account) && Objects.equals(companyId, that.companyId) && Objects.equals(swiftCode, that.swiftCode) && Objects.equals(intermediarySwiftCode, that.intermediarySwiftCode) && Objects.equals(name, that.name) && Objects.equals(address, that.address) && Objects.equals(bankAddress, that.bankAddress) && Objects.equals(bankSwiftCode, that.bankSwiftCode) && Objects.equals(bankAccount, that.bankAccount) && Objects.equals(bankName1, that.bankName1) && Objects.equals(bankAddress1, that.bankAddress1) && Objects.equals(bankAccount1, that.bankAccount1) && Objects.equals(bankName2, that.bankName2) && Objects.equals(bankAddress2, that.bankAddress2) && Objects.equals(intermediarySwiftCode2, that.intermediarySwiftCode2) && Objects.equals(bankAccount2, that.bankAccount2) && Objects.equals(personalAccount, that.personalAccount) && Objects.equals(budgetClassificationCode, that.budgetClassificationCode) && Objects.equals(oktmo, that.oktmo);
}
@Override
public int hashCode() {
return Objects.hash(bankIdentificationCode, bankName, correspondentAccount, correspondentAccountName, currency, destination, taxpayerIdentificationNumber, taxRegistrationReasonCode, account, companyId, swiftCode, intermediarySwiftCode, name, address, bankAddress, bankSwiftCode, bankAccount, bankName1, bankAddress1, bankAccount1, bankName2, bankAddress2, intermediarySwiftCode2, bankAccount2, personalAccount, budgetClassificationCode, oktmo);
}
@Override
public String toString() {
return "BankAccountNewAction{" +
"bankIdentificationCode='" + bankIdentificationCode + '\'' +
", bankName='" + bankName + '\'' +
", correspondentAccount='" + correspondentAccount + '\'' +
", correspondentAccountName='" + correspondentAccountName + '\'' +
", currency='" + currency + '\'' +
", destination='" + destination + '\'' +
", taxpayerIdentificationNumber='" + taxpayerIdentificationNumber + '\'' +
", taxRegistrationReasonCode='" + taxRegistrationReasonCode + '\'' +
", account='" + account + '\'' +
", companyId=" + companyId +
", swiftCode='" + swiftCode + '\'' +
", intermediarySwiftCode='" + intermediarySwiftCode + '\'' +
", name='" + name + '\'' +
", address='" + address + '\'' +
", bankAddress='" + bankAddress + '\'' +
", bankSwiftCode='" + bankSwiftCode + '\'' +
", bankAccount='" + bankAccount + '\'' +
", bankName1='" + bankName1 + '\'' +
", bankAddress1='" + bankAddress1 + '\'' +
", bankAccount1='" + bankAccount1 + '\'' +
", bankName2='" + bankName2 + '\'' +
", bankAddress2='" + bankAddress2 + '\'' +
", intermediarySwiftCode2='" + intermediarySwiftCode2 + '\'' +
", bankAccount2='" + bankAccount2 + '\'' +
", personalAccount='" + personalAccount + '\'' +
", budgetClassificationCode='" + budgetClassificationCode + '\'' +
", oktmo='" + oktmo + '\'' +
'}';
}
}

View file

@ -9,8 +9,11 @@ import ru.spcex.clearing.xml.importer.logic.data.ResultContainer;
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
import ru.spcex.clearing.xml.importer.logic.data.enums.FileType;
import ru.spcex.clearing.xml.importer.logic.data.enums.StageResult;
import ru.spcex.clearing.xml.importer.logic.data.kafka.BankAccountNewAction;
import ru.spcex.clearing.xml.importer.logic.data.tags.lks.AccountListCur;
import ru.spcex.clearing.xml.importer.logic.data.tags.lks.AccountListRub;
import ru.spcex.clearing.xml.importer.logic.data.tags.lks.registrator.client.account.AccountTagCur;
import ru.spcex.clearing.xml.importer.logic.data.tags.lks.registrator.client.account.AccountTagRub;
import ru.spcex.clearing.xml.importer.logic.data.tags.sdf.DocumentTag;
import ru.spcex.clearing.xml.importer.logic.data.tags.sdf.objects.ObjectTag;
import ru.spcex.platform.classes.base.SpcexObjectBase;
@ -76,12 +79,52 @@ public class ImportToDB {
private StageResult processLksFile(ResultContainer resultContainer) {
if (resultContainer.getXmlTable().equals(ETable.ACCOUNT_LIST_RUB)) {
AccountListRub accountListRub = (AccountListRub) resultContainer.getXmlFile();
log.info(accountListRub.toString());
AccountTagRub accountTagRub = accountListRub.getRegistrator().getClient().getAccount();
BankAccountNewAction bankAccountNewAction = new BankAccountNewAction();
bankAccountNewAction.setBankIdentificationCode(accountTagRub.getBic());
bankAccountNewAction.setBankName(accountTagRub.getBankName());
bankAccountNewAction.setCorrespondentAccount(accountTagRub.getCorrespondentAccount());
bankAccountNewAction.setCurrency(accountTagRub.getCurrency());
bankAccountNewAction.setDestination(accountTagRub.getDestination());
bankAccountNewAction.setTaxpayerIdentificationNumber(accountTagRub.getTin());
bankAccountNewAction.setTaxRegistrationReasonCode(accountTagRub.getTrrc());
bankAccountNewAction.setAccount(accountTagRub.getAccount());
bankAccountNewAction.setName(accountTagRub.getName());
bankAccountNewAction.setBankAddress(accountTagRub.getBankAddress());
bankAccountNewAction.setPersonalAccount(accountTagRub.getPersonalAccount());
bankAccountNewAction.setBudgetClassificationCode(accountTagRub.getBudgetClassificationCode());
bankAccountNewAction.setOktmo(accountTagRub.getOktmo());
// No DISCONTINUATION_DATE in BankAccountNewAction
kafkaMessenger.sendToBankAccount(bankAccountNewAction);
return StageResult.OK;
} else if (resultContainer.getXmlTable().equals(ETable.ACCOUNT_LIST_CUR)) {
AccountListCur accountListCur = (AccountListCur) resultContainer.getXmlFile();
log.info(accountListCur.toString());
AccountTagCur accountTagCur = accountListCur.getRegistrator().getClient().getAccount();
BankAccountNewAction bankAccountNewAction = new BankAccountNewAction();
bankAccountNewAction.setBankName(accountTagCur.getBankName());
bankAccountNewAction.setCurrency(accountTagCur.getCurrency());
bankAccountNewAction.setDestination(accountTagCur.getDestination());
bankAccountNewAction.setAccount(accountTagCur.getAccount());
bankAccountNewAction.setSwiftCode(accountTagCur.getSwiftCode());
bankAccountNewAction.setIntermediarySwiftCode(accountTagCur.getIntermediarySwiftCode1());
bankAccountNewAction.setName(accountTagCur.getName());
bankAccountNewAction.setAddress(accountTagCur.getAddress());
bankAccountNewAction.setBankAddress(accountTagCur.getBankAddress());
bankAccountNewAction.setBankSwiftCode(accountTagCur.getBankSwiftCode());
bankAccountNewAction.setBankAccount(accountTagCur.getBankAccount());
bankAccountNewAction.setBankName1(accountTagCur.getBankName1());
bankAccountNewAction.setBankAddress1(accountTagCur.getBankAddress1());
bankAccountNewAction.setBankAccount1(accountTagCur.getBankAccount1());
bankAccountNewAction.setBankName2(accountTagCur.getBankName2());
bankAccountNewAction.setBankAddress2(accountTagCur.getBankAddress2());
bankAccountNewAction.setIntermediarySwiftCode2(accountTagCur.getIntermediarySwiftCode2());
bankAccountNewAction.setBankAccount2(accountTagCur.getBankAccount2());
kafkaMessenger.sendToBankAccount(bankAccountNewAction);
return StageResult.OK;
}

View file

@ -23,6 +23,7 @@ import ru.spcex.clearing.xml.importer.logic.data.ResultContainer;
import ru.spcex.clearing.xml.importer.logic.data.enums.ETable;
import ru.spcex.clearing.xml.importer.logic.data.enums.FileType;
import ru.spcex.clearing.xml.importer.logic.data.enums.StageResult;
import ru.spcex.clearing.xml.importer.logic.data.kafka.BankAccountNewAction;
import ru.spcex.platform.enumeration.ObjectType;
import ru.spcex.platform.enumeration.Priority;
import ru.spcex.platform.enumeration.SdfTable;
@ -55,6 +56,11 @@ public class XmlImportKafkaMessenger implements InitializingBean {
messengers.put(ETable.DF_57, groupId -> messageStatement(groupId, SdfTable.SDF_57, FileType.SDF));
}
public void sendToBankAccount(BankAccountNewAction bankAccountNewAction) {
kafkaSdf.get().sendRequestToQueue(Consts.DESTINATION_BANK_ACCOUNT_NEW, bankAccountNewAction);
log.info("Message to {} was sent {}", Consts.DESTINATION_BANK_ACCOUNT_NEW, bankAccountNewAction);
}
/**
* отправляет в кафку сообщение, при необходимости
* (обрабатывается, например, в balance-service, clearing-service)