diff --git a/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/data/kafka/BankAccountNewAction.java b/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/data/kafka/BankAccountNewAction.java deleted file mode 100644 index 6fc3b5e1c..000000000 --- a/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/data/kafka/BankAccountNewAction.java +++ /dev/null @@ -1,295 +0,0 @@ -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 + '\'' + - '}'; - } -} diff --git a/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/steps/ImportToDB.java b/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/steps/ImportToDB.java index 02ae62784..d48f414aa 100644 --- a/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/steps/ImportToDB.java +++ b/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/steps/ImportToDB.java @@ -5,11 +5,11 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; import ru.clearing.classes.statics.data.sdf.SDf57; +import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountNewRequest; 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; @@ -78,53 +78,57 @@ public class ImportToDB { private StageResult processLksFile(ResultContainer resultContainer) { if (resultContainer.getXmlTable().equals(ETable.ACCOUNT_LIST_RUB)) { - AccountListRub accountListRub = (AccountListRub) resultContainer.getXmlFile(); - AccountTagRub accountTagRub = accountListRub.getRegistrator().getClient().getAccount(); + AccountTagRub accountTagRub = ((AccountListRub) resultContainer.getXmlFile()) + .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()); + BankAccountNewRequest bankAccountNewRequest = new BankAccountNewRequest(); + bankAccountNewRequest.setBankIdentificationCode(accountTagRub.getBic()); + bankAccountNewRequest.setBankName(accountTagRub.getBankName()); + bankAccountNewRequest.setCorrespondentAccount(accountTagRub.getCorrespondentAccount()); + bankAccountNewRequest.setCurrency(accountTagRub.getCurrency()); + bankAccountNewRequest.setDestination(accountTagRub.getDestination()); + bankAccountNewRequest.setTaxpayerIdentificationNumber(accountTagRub.getTin()); + bankAccountNewRequest.setTaxRegistrationReasonCode(accountTagRub.getTrrc()); + bankAccountNewRequest.setAccount(accountTagRub.getAccount()); + bankAccountNewRequest.setName(accountTagRub.getName()); + bankAccountNewRequest.setBankAddress(accountTagRub.getBankAddress()); + bankAccountNewRequest.setPersonalAccount(accountTagRub.getPersonalAccount()); + bankAccountNewRequest.setBudgetClassificationCode(accountTagRub.getBudgetClassificationCode()); + bankAccountNewRequest.setOktmo(accountTagRub.getOktmo()); // No DISCONTINUATION_DATE in BankAccountNewAction - kafkaMessenger.sendToBankAccount(bankAccountNewAction); + kafkaMessenger.sendToBankAccount(bankAccountNewRequest); return StageResult.OK; } else if (resultContainer.getXmlTable().equals(ETable.ACCOUNT_LIST_CUR)) { - AccountListCur accountListCur = (AccountListCur) resultContainer.getXmlFile(); - AccountTagCur accountTagCur = accountListCur.getRegistrator().getClient().getAccount(); + AccountTagCur accountTagCur = ((AccountListCur) resultContainer.getXmlFile()) + .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()); + BankAccountNewRequest bankAccountNewRequest = new BankAccountNewRequest(); + bankAccountNewRequest.setBankName(accountTagCur.getBankName()); + bankAccountNewRequest.setCurrency(accountTagCur.getCurrency()); + bankAccountNewRequest.setDestination(accountTagCur.getDestination()); + bankAccountNewRequest.setAccount(accountTagCur.getAccount()); + bankAccountNewRequest.setSwiftCode(accountTagCur.getSwiftCode()); + bankAccountNewRequest.setIntermediarySwiftCode(accountTagCur.getIntermediarySwiftCode1()); + bankAccountNewRequest.setName(accountTagCur.getName()); + bankAccountNewRequest.setAddress(accountTagCur.getAddress()); + bankAccountNewRequest.setBankAddress(accountTagCur.getBankAddress()); + bankAccountNewRequest.setBankSwiftCode(accountTagCur.getBankSwiftCode()); + bankAccountNewRequest.setBankAccount(accountTagCur.getBankAccount()); + bankAccountNewRequest.setBankName1(accountTagCur.getBankName1()); + bankAccountNewRequest.setBankAddress1(accountTagCur.getBankAddress1()); + bankAccountNewRequest.setBankAccount1(accountTagCur.getBankAccount1()); + bankAccountNewRequest.setBankName2(accountTagCur.getBankName2()); + bankAccountNewRequest.setBankAddress2(accountTagCur.getBankAddress2()); + bankAccountNewRequest.setIntermediarySwiftCode2(accountTagCur.getIntermediarySwiftCode2()); + bankAccountNewRequest.setBankAccount2(accountTagCur.getBankAccount2()); - kafkaMessenger.sendToBankAccount(bankAccountNewAction); + kafkaMessenger.sendToBankAccount(bankAccountNewRequest); return StageResult.OK; } diff --git a/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/steps/XmlImportKafkaMessenger.java b/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/steps/XmlImportKafkaMessenger.java index e1e295d28..ce4bfbb30 100644 --- a/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/steps/XmlImportKafkaMessenger.java +++ b/clearing-parent/xml-importer/src/main/java/ru/spcex/clearing/xml/importer/logic/steps/XmlImportKafkaMessenger.java @@ -12,6 +12,7 @@ import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; import ru.spcex.clearing.platform.messaging.domain.Consts; +import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountNewRequest; import ru.spcex.clearing.platform.messaging.domain.cud.balance.StatementRequest; import ru.spcex.clearing.platform.messaging.domain.cud.clearing.Sdf04Request; import ru.spcex.clearing.platform.messaging.domain.cud.utilities.NotificationNewRequest; @@ -23,7 +24,6 @@ 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; @@ -56,9 +56,9 @@ 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); + public void sendToBankAccount(BankAccountNewRequest bankAccountNewRequest) { + kafkaSdf.get().sendRequestToQueue(Consts.DESTINATION_BANK_ACCOUNT_NEW, bankAccountNewRequest); + log.info("Message to {} was sent {}", Consts.DESTINATION_BANK_ACCOUNT_NEW, bankAccountNewRequest); } /**