ialbert 2022-10-31 11:35:02 +03:00
parent 927b033763
commit 08315f7518
7 changed files with 557 additions and 0 deletions

View file

@ -0,0 +1,66 @@
package ru.clearing.classes.statics.data.misc;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.objects.BusinessObject;
import java.time.Instant;
import java.time.LocalDate;
public class Notification extends BusinessObject {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private LocalDate clearingDate;
private Long senderId;
private Long addresseeId;
private String objectType;
private Instant objectId;
private String notificationStatus;
public LocalDate getClearingDate() {
return clearingDate;
}
public void setClearingDate(LocalDate clearingDate) {
this.clearingDate = clearingDate;
}
public Long getSenderId() {
return senderId;
}
public void setSenderId(Long senderId) {
this.senderId = senderId;
}
public Long getAddresseeId() {
return addresseeId;
}
public void setAddresseeId(Long addresseeId) {
this.addresseeId = addresseeId;
}
public String getObjectType() {
return objectType;
}
public void setObjectType(String objectType) {
this.objectType = objectType;
}
public Instant getObjectId() {
return objectId;
}
public void setObjectId(Instant objectId) {
this.objectId = objectId;
}
public String getNotificationStatus() {
return notificationStatus;
}
public void setNotificationStatus(String notificationStatus) {
this.notificationStatus = notificationStatus;
}
}

View file

@ -0,0 +1,28 @@
package ru.clearing.classes.statics.data.misc;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.objects.BusinessObject;
import java.time.LocalDate;
public class Session extends BusinessObject {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private LocalDate clearingDate;
private String sessionStatus;
public LocalDate getClearingDate() {
return clearingDate;
}
public void setClearingDate(LocalDate clearingDate) {
this.clearingDate = clearingDate;
}
public String getSessionStatus() {
return sessionStatus;
}
public void setSessionStatus(String sessionStatus) {
this.sessionStatus = sessionStatus;
}
}

View file

@ -0,0 +1,227 @@
package ru.clearing.classes.statics.data.payment;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.objects.BusinessObject;
import java.time.Instant;
import java.time.LocalDate;
public class PaymentInstruction extends BusinessObject {
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private Long senderId; // type="1"
private Long addresseeId; // type="1"
private String adresseeBIC; // type="2"
private String payeeBankName; // type="2"
private String payeeBIC; // type="2"
private String addresseeBankName; // type="2"
private Instant paymentDate; // type="4"
private String paymentPurpose; // type="2"
private LocalDate settlementDate; // type="6"
private Long creditLegAmount; // type="1"
private Long debitLegAmount; // type="1"
private Long creditLegAccountId; // type="1"
private String creditCsAccount; // type="2"
private String creditLegAccount; // type="2"
private Long debitLegAccountId; // type="1"
private String debitCsAccount; // type="2"
private String debitLegAccount; // type="2"
private Long creditLegDirection; // type="1"
private Long debitLegDirection; // type="1"
private String creditLegCurrencyCode; // type="12"
private String debitLegCurrencyCode; // type="12"
private LocalDate clearingDate; // type="6"
private String transactionStatus; // type="12"
private String documentNumber; // type="2"
public Long getSenderId() {
return senderId;
}
public void setSenderId(Long senderId) {
this.senderId = senderId;
}
public Long getAddresseeId() {
return addresseeId;
}
public void setAddresseeId(Long addresseeId) {
this.addresseeId = addresseeId;
}
public String getAdresseeBIC() {
return adresseeBIC;
}
public void setAdresseeBIC(String adresseeBIC) {
this.adresseeBIC = adresseeBIC;
}
public String getPayeeBankName() {
return payeeBankName;
}
public void setPayeeBankName(String payeeBankName) {
this.payeeBankName = payeeBankName;
}
public String getPayeeBIC() {
return payeeBIC;
}
public void setPayeeBIC(String payeeBIC) {
this.payeeBIC = payeeBIC;
}
public String getAddresseeBankName() {
return addresseeBankName;
}
public void setAddresseeBankName(String addresseeBankName) {
this.addresseeBankName = addresseeBankName;
}
public Instant getPaymentDate() {
return paymentDate;
}
public void setPaymentDate(Instant paymentDate) {
this.paymentDate = paymentDate;
}
public String getPaymentPurpose() {
return paymentPurpose;
}
public void setPaymentPurpose(String paymentPurpose) {
this.paymentPurpose = paymentPurpose;
}
public LocalDate getSettlementDate() {
return settlementDate;
}
public void setSettlementDate(LocalDate settlementDate) {
this.settlementDate = settlementDate;
}
public Long getCreditLegAmount() {
return creditLegAmount;
}
public void setCreditLegAmount(Long creditLegAmount) {
this.creditLegAmount = creditLegAmount;
}
public Long getDebitLegAmount() {
return debitLegAmount;
}
public void setDebitLegAmount(Long debitLegAmount) {
this.debitLegAmount = debitLegAmount;
}
public Long getCreditLegAccountId() {
return creditLegAccountId;
}
public void setCreditLegAccountId(Long creditLegAccountId) {
this.creditLegAccountId = creditLegAccountId;
}
public String getCreditCsAccount() {
return creditCsAccount;
}
public void setCreditCsAccount(String creditCsAccount) {
this.creditCsAccount = creditCsAccount;
}
public String getCreditLegAccount() {
return creditLegAccount;
}
public void setCreditLegAccount(String creditLegAccount) {
this.creditLegAccount = creditLegAccount;
}
public Long getDebitLegAccountId() {
return debitLegAccountId;
}
public void setDebitLegAccountId(Long debitLegAccountId) {
this.debitLegAccountId = debitLegAccountId;
}
public String getDebitCsAccount() {
return debitCsAccount;
}
public void setDebitCsAccount(String debitCsAccount) {
this.debitCsAccount = debitCsAccount;
}
public String getDebitLegAccount() {
return debitLegAccount;
}
public void setDebitLegAccount(String debitLegAccount) {
this.debitLegAccount = debitLegAccount;
}
public Long getCreditLegDirection() {
return creditLegDirection;
}
public void setCreditLegDirection(Long creditLegDirection) {
this.creditLegDirection = creditLegDirection;
}
public Long getDebitLegDirection() {
return debitLegDirection;
}
public void setDebitLegDirection(Long debitLegDirection) {
this.debitLegDirection = debitLegDirection;
}
public String getCreditLegCurrencyCode() {
return creditLegCurrencyCode;
}
public void setCreditLegCurrencyCode(String creditLegCurrencyCode) {
this.creditLegCurrencyCode = creditLegCurrencyCode;
}
public String getDebitLegCurrencyCode() {
return debitLegCurrencyCode;
}
public void setDebitLegCurrencyCode(String debitLegCurrencyCode) {
this.debitLegCurrencyCode = debitLegCurrencyCode;
}
public LocalDate getClearingDate() {
return clearingDate;
}
public void setClearingDate(LocalDate clearingDate) {
this.clearingDate = clearingDate;
}
public String getTransactionStatus() {
return transactionStatus;
}
public void setTransactionStatus(String transactionStatus) {
this.transactionStatus = transactionStatus;
}
public String getDocumentNumber() {
return documentNumber;
}
public void setDocumentNumber(String documentNumber) {
this.documentNumber = documentNumber;
}
}

View file

@ -0,0 +1,75 @@
package ru.spcex.clearing.imdg.object;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.misc.Notification;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.imdg.base.TemplateMapStore;
import java.sql.ResultSet;
import java.sql.SQLException;
@Component
public class NotificationMapStore extends TemplateMapStore<Notification> {
public NotificationMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "NOTIFICATION";
}
@Override
public String getMapName() {
return IMDGDistributedNames.Map_Notification;
}
@Override
public String[] getFields() {
return new String[]{
"id",
"created_at",
"updated_at",
"clearing_date",
"sender_id",
"addressee_id",
"object_type",
"object_id",
"notification_status"
};
}
@Override
protected Notification objectReader(ResultSet resultSet) throws SQLException {
Notification notification = new Notification();
notification.setId(resultSet.getLong("id"));
notification.setCreated(getInstantFromTimestamp(resultSet, "created_at"));
notification.setUpdated(getInstantFromTimestamp(resultSet, "updated_at"));
notification.setClearingDate(getLocalDateFromSqlDate(resultSet, "clearing_date"));
notification.setSenderId(resultSet.getLong("sender_id"));
notification.setAddresseeId(resultSet.getLong("addressee_id"));
notification.setObjectType(resultSet.getString("object_type"));
notification.setObjectId(getInstantFromTimestamp(resultSet, "object_id"));
notification.setNotificationStatus(resultSet.getString("notification_status"));
return notification;
}
@Override
protected Object[] objectToField(Notification notification) {
Object[] args = new Object[]{
notification.getId(),
notification.getCreated(),
notification.getUpdated(),
notification.getClearingDate(),
notification.getSenderId(),
notification.getAddresseeId(),
notification.getObjectType(),
notification.getObjectId(),
notification.getNotificationStatus()
};
return args;
}
}

View file

@ -0,0 +1,101 @@
package ru.spcex.clearing.imdg.object;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.payment.PaymentInstruction;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.imdg.base.TemplateMapStore;
import java.sql.ResultSet;
import java.sql.SQLException;
@Component
public class PaymentInstructionMapStore extends TemplateMapStore<PaymentInstruction> {
public PaymentInstructionMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "PAYMENT_INSTRUCTION";
}
@Override
public String getMapName() {
return IMDGDistributedNames.Map_PaymentInstruction;
}
@Override
public String[] getFields() {
return new String[]{"id", "created_at", "updated_at", "sender_id", "addressee_id", "adressee_b_i_c", "payee_bank_name", "payee_b_i_c", "addressee_bank_name", "payment_date", "_payment_purpose", "settlement_date", "credit_leg_amount", "debit_leg_amount", "credit_leg_account_id", "credit_cs_account", "credit_leg_account", "debit_leg_account_id", "debit_cs_account", "debit_leg_account", "credit_leg_direction", "debit_leg_direction", "credit_leg_currency_code", "debit_leg_currency_code", "clearing_date", "transaction_status", "document_number"};
}
@Override
protected PaymentInstruction objectReader(ResultSet resultSet) throws SQLException {
PaymentInstruction paymentInstruction = new PaymentInstruction();
paymentInstruction.setId(resultSet.getObject("ID", Long.class));
paymentInstruction.setCreated(getInstantFromTimestamp(resultSet, "created_at"));
paymentInstruction.setUpdated(getInstantFromTimestamp(resultSet, "updated_at"));
paymentInstruction.setSenderId(resultSet.getLong("sender_id"));
paymentInstruction.setAddresseeId(resultSet.getLong("addressee_id"));
paymentInstruction.setAdresseeBIC(resultSet.getString("adressee_b_i_c"));
paymentInstruction.setPayeeBankName(resultSet.getString("payee_bank_name"));
paymentInstruction.setPayeeBIC(resultSet.getString("payee_b_i_c"));
paymentInstruction.setAddresseeBankName(resultSet.getString("addressee_bank_name"));
paymentInstruction.setPaymentDate(getInstantFromTimestamp(resultSet, "payment_date"));
paymentInstruction.setPaymentPurpose(resultSet.getString("_payment_purpose"));
paymentInstruction.setSettlementDate(getLocalDateFromSqlDate(resultSet, "settlement_date"));
paymentInstruction.setCreditLegAmount(resultSet.getLong("credit_leg_amount"));
paymentInstruction.setDebitLegAmount(resultSet.getLong("debit_leg_amount"));
paymentInstruction.setCreditLegAccountId(resultSet.getLong("credit_leg_account_id"));
paymentInstruction.setCreditCsAccount(resultSet.getString("credit_cs_account"));
paymentInstruction.setCreditLegAccount(resultSet.getString("credit_leg_account"));
paymentInstruction.setDebitLegAccountId(resultSet.getLong("debit_leg_account_id"));
paymentInstruction.setDebitCsAccount(resultSet.getString("debit_cs_account"));
paymentInstruction.setDebitLegAccount(resultSet.getString("debit_leg_account"));
paymentInstruction.setCreditLegDirection(resultSet.getLong("credit_leg_direction"));
paymentInstruction.setDebitLegDirection(resultSet.getLong("debit_leg_direction"));
paymentInstruction.setCreditLegCurrencyCode(resultSet.getString("credit_leg_currency_code"));
paymentInstruction.setDebitLegCurrencyCode(resultSet.getString("debit_leg_currency_code"));
paymentInstruction.setClearingDate(getLocalDateFromSqlDate(resultSet, "clearing_date"));
paymentInstruction.setTransactionStatus(resultSet.getString("transaction_status"));
paymentInstruction.setDocumentNumber(resultSet.getString("document_number"));
return paymentInstruction;
}
@Override
protected Object[] objectToField(PaymentInstruction paymentInstruction) {
Object[] args = new Object[]{
paymentInstruction.getId(),
paymentInstruction.getCreated(),
paymentInstruction.getUpdated(),
paymentInstruction.getSenderId(),
paymentInstruction.getAddresseeId(),
paymentInstruction.getAdresseeBIC(),
paymentInstruction.getPayeeBankName(),
paymentInstruction.getPayeeBIC(),
paymentInstruction.getAddresseeBankName(),
paymentInstruction.getPaymentDate(),
paymentInstruction.getPaymentPurpose(),
paymentInstruction.getSettlementDate(),
paymentInstruction.getCreditLegAmount(),
paymentInstruction.getDebitLegAmount(),
paymentInstruction.getCreditLegAccountId(),
paymentInstruction.getCreditCsAccount(),
paymentInstruction.getCreditLegAccount(),
paymentInstruction.getDebitLegAccountId(),
paymentInstruction.getDebitCsAccount(),
paymentInstruction.getDebitLegAccount(),
paymentInstruction.getCreditLegDirection(),
paymentInstruction.getDebitLegDirection(),
paymentInstruction.getCreditLegCurrencyCode(),
paymentInstruction.getDebitLegCurrencyCode(),
paymentInstruction.getClearingDate(),
paymentInstruction.getTransactionStatus(),
paymentInstruction.getDocumentNumber(),
};
return args;
}
}

View file

@ -0,0 +1,57 @@
package ru.spcex.clearing.imdg.object;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.misc.Session;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.imdg.base.TemplateMapStore;
import java.sql.ResultSet;
import java.sql.SQLException;
@Component
public class SessionMapStore extends TemplateMapStore<Session> {
public SessionMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getTableName() {
return "SESSION";
}
@Override
public String getMapName() {
return IMDGDistributedNames.Map_Session;
}
@Override
public String[] getFields() {
return new String[]{"id", "created_at", "updated_at", "clearing_date", "session_status"};
}
@Override
protected Session objectReader(ResultSet resultSet) throws SQLException {
Session session = new Session();
session.setId(resultSet.getLong("id"));
session.setCreated(getInstantFromTimestamp(resultSet, "created_at"));
session.setUpdated(getInstantFromTimestamp(resultSet, "updated_at"));
session.setClearingDate(getLocalDateFromSqlDate(resultSet, "clearing_date"));
session.setSessionStatus(resultSet.getString("session_status"));
return session;
}
@Override
protected Object[] objectToField(Session session) {
Object[] args = new Object[]{
session.getId(),
session.getCreated(),
session.getUpdated(),
session.getClearingDate(),
session.getSessionStatus()
};
return args;
}
}

View file

@ -105,6 +105,9 @@ public final class IMDGDistributedNames {
public static final String Map_MoneyMarketSecurity = "Map_MoneyMarketSecurity";
public static final String Map_Currency = "Map_Currency";
public static final String Map_RequestInfo = "Map_RequestInfo";
public static final String Map_PaymentInstruction = "Map_PaymentInstruction";
public static final String Map_Session = "Map_Session";
public static final String Map_Notification = "Map_Notification";
public static final String MAP_SEQUENCE_NAME = "MAP_SEQUENCE_NAME"; // todo вынести idGenerator отдельно и завернуть в метод, чтобы не напрямую обращаться.
private IMDGDistributedNames() {