From b6fa8e7d792205fd9ba892be55683240872b033e Mon Sep 17 00:00:00 2001 From: AKurakin Date: Mon, 30 Jan 2023 13:20:15 +0300 Subject: [PATCH] =?UTF-8?q?imdg=20http://jira.mfd.msk:8088/browse/CLS-188?= =?UTF-8?q?=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20=D0=BC=D0=B0?= =?UTF-8?q?=D0=BF=D1=83=20STrade?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/meta/meta.xml | 2 +- .../classes/statics/data/misc/STrade.java | 189 ++++++++++++++++++ .../clearing/imdg/object/STradeMapStore.java | 94 +++++++++ .../structure/RunnableMapNamesForTesting.java | 1 + .../clearing/imdg/IMDGDistributedNames.java | 1 + 5 files changed, 286 insertions(+), 1 deletion(-) create mode 100644 clearing-parent/classes/src/main/java/ru/clearing/classes/statics/data/misc/STrade.java create mode 100644 clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/object/STradeMapStore.java diff --git a/clearing-parent/backend-api/src/main/resources/meta/meta.xml b/clearing-parent/backend-api/src/main/resources/meta/meta.xml index f8f91c229..058667e6d 100644 --- a/clearing-parent/backend-api/src/main/resources/meta/meta.xml +++ b/clearing-parent/backend-api/src/main/resources/meta/meta.xml @@ -1576,7 +1576,7 @@ - + diff --git a/clearing-parent/classes/src/main/java/ru/clearing/classes/statics/data/misc/STrade.java b/clearing-parent/classes/src/main/java/ru/clearing/classes/statics/data/misc/STrade.java new file mode 100644 index 000000000..74e2f821d --- /dev/null +++ b/clearing-parent/classes/src/main/java/ru/clearing/classes/statics/data/misc/STrade.java @@ -0,0 +1,189 @@ +package ru.clearing.classes.statics.data.misc; + +import ru.clearing.classes.ConstSerializable; +import ru.spcex.platform.classes.base.SpcexObjectBase; + +import java.math.BigDecimal; +import java.time.Instant; +import java.time.LocalDate; + +/** + * Сделки из Торговой системы + *

+ * DB table: S_TRADE + **/ +public class STrade extends SpcexObjectBase { + private static final long serialVersionUID = ConstSerializable.serialVersionUID; + + private Long trade_num; + private String sec_code; + private Instant trade_date_time; + private LocalDate settle_date; + private BigDecimal price; + private BigDecimal value; + private BigDecimal qty; + private BigDecimal accruedint; + private String firm_id; + private String client_code; + private BigDecimal exchange_commission; + private String class_code; + private String operation; + private String issue_account; + private String money_account; + private String trade_type; + private Long days_to_mat_date; + private String collateral; + private String settle_code; + + public Long getTrade_num() { + return trade_num; + } + + public void setTrade_num(Long value) { + this.trade_num = value; + } + + public String getSec_code() { + return sec_code; + } + + public void setSec_code(String value) { + this.sec_code = value; + } + + public Instant getTrade_date_time() { + return trade_date_time; + } + + public void setTrade_date_time(Instant value) { + this.trade_date_time = value; + } + + public LocalDate getSettle_date() { + return settle_date; + } + + public void setSettle_date(LocalDate value) { + this.settle_date = value; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal value) { + this.price = value; + } + + public BigDecimal getValue() { + return value; + } + + public void setValue(BigDecimal value) { + this.value = value; + } + + public BigDecimal getQty() { + return qty; + } + + public void setQty(BigDecimal value) { + this.qty = value; + } + + public BigDecimal getAccruedint() { + return accruedint; + } + + public void setAccruedint(BigDecimal value) { + this.accruedint = value; + } + + public String getFirm_id() { + return firm_id; + } + + public void setFirm_id(String value) { + this.firm_id = value; + } + + public String getClient_code() { + return client_code; + } + + public void setClient_code(String value) { + this.client_code = value; + } + + public BigDecimal getExchange_commission() { + return exchange_commission; + } + + public void setExchange_commission(BigDecimal value) { + this.exchange_commission = value; + } + + public String getClass_code() { + return class_code; + } + + public void setClass_code(String value) { + this.class_code = value; + } + + public String getOperation() { + return operation; + } + + public void setOperation(String value) { + this.operation = value; + } + + public String getIssue_account() { + return issue_account; + } + + public void setIssue_account(String value) { + this.issue_account = value; + } + + public String getMoney_account() { + return money_account; + } + + public void setMoney_account(String value) { + this.money_account = value; + } + + public String getTrade_type() { + return trade_type; + } + + public void setTrade_type(String value) { + this.trade_type = value; + } + + public Long getDays_to_mat_date() { + return days_to_mat_date; + } + + public void setDays_to_mat_date(Long value) { + this.days_to_mat_date = value; + } + + public String getCollateral() { + return collateral; + } + + public void setCollateral(String value) { + this.collateral = value; + } + + public String getSettle_code() { + return settle_code; + } + + public void setSettle_code(String value) { + this.settle_code = value; + } +} diff --git a/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/object/STradeMapStore.java b/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/object/STradeMapStore.java new file mode 100644 index 000000000..fcdc90465 --- /dev/null +++ b/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/object/STradeMapStore.java @@ -0,0 +1,94 @@ +package ru.spcex.clearing.imdg.object; + +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Component; +import ru.clearing.classes.statics.data.misc.STrade; +import ru.spcex.clearing.imdg.IMDGDistributedNames; +import ru.spcex.clearing.imdg.base.TemplateMapStore; +import ru.spcex.platform.utils.time.TimeUtil; + +import java.math.BigDecimal; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.time.LocalDate; + +@Component +public class STradeMapStore extends TemplateMapStore { + + public STradeMapStore(JdbcTemplate jdbcTemplate) { + super(jdbcTemplate); + } + + @Override + public String getMapName() { + return IMDGDistributedNames.Map_STrade; + } + + @Override + public String getTableName() { + return "S_TRADE"; + } + + @Override + public String[] getFields() { + return new String[]{ + "ID", "TRADE_NUM", "SEC_CODE", "TRADE_DATE_TIME", "SETTLE_DATE", "PRICE", "VALUE", "QTY", "ACCRUEDINT", + "FIRM_ID", "CLIENT_CODE", "EXCHANGE_COMMISSION", "CLASS_CODE", "OPERATION", "ISSUE_ACCOUNT", + "MONEY_ACCOUNT", "TRADE_TYPE", "DAYS_TO_MAT_DATE", "COLLATERAL", "SETTLE_CODE" + }; + } + + @Override + public STrade objectReader(ResultSet resultSet) throws SQLException { + STrade object = new STrade(); + object.setId(resultSet.getObject("ID", Long.class)); + object.setTrade_num(resultSet.getObject("TRADE_NUM", Long.class)); + object.setSec_code(resultSet.getObject("SEC_CODE", String.class)); + object.setTrade_date_time(getInstantFromTimestamp(resultSet, "TRADE_DATE_TIME")); + object.setSettle_date(resultSet.getObject("SETTLE_DATE", LocalDate.class)); + object.setPrice(resultSet.getObject("PRICE", BigDecimal.class)); + object.setValue(resultSet.getObject("VALUE", BigDecimal.class)); + object.setQty(resultSet.getObject("QTY", BigDecimal.class)); + object.setAccruedint(resultSet.getObject("ACCRUEDINT", BigDecimal.class)); + object.setFirm_id(resultSet.getObject("FIRM_ID", String.class)); + object.setClient_code(resultSet.getObject("CLIENT_CODE", String.class)); + object.setExchange_commission(resultSet.getObject("EXCHANGE_COMMISSION", BigDecimal.class)); + object.setClass_code(resultSet.getObject("CLASS_CODE", String.class)); + object.setOperation(resultSet.getObject("OPERATION", String.class)); + object.setIssue_account(resultSet.getObject("ISSUE_ACCOUNT", String.class)); + object.setMoney_account(resultSet.getObject("MONEY_ACCOUNT", String.class)); + object.setTrade_type(resultSet.getObject("TRADE_TYPE", String.class)); + object.setDays_to_mat_date(resultSet.getObject("DAYS_TO_MAT_DATE", Long.class)); + object.setCollateral(resultSet.getObject("COLLATERAL", String.class)); + object.setSettle_code(resultSet.getObject("SETTLE_CODE", String.class)); + return object; + } + + @Override + public Object[] objectToField(STrade object) { + Object[] args = new Object[]{ + object.getId(), + object.getTrade_num(), + object.getSec_code(), + TimeUtil.toDateFromInstant(object.getTrade_date_time()), + object.getSettle_date(), + object.getPrice(), + object.getValue(), + object.getQty(), + object.getAccruedint(), + object.getFirm_id(), + object.getClient_code(), + object.getExchange_commission(), + object.getClass_code(), + object.getOperation(), + object.getIssue_account(), + object.getMoney_account(), + object.getTrade_type(), + object.getDays_to_mat_date(), + object.getCollateral(), + object.getSettle_code() + }; + return args; + } + +} diff --git a/clearing-parent/imdg/src/test/java/ru/spcex/clearing/imdg/structure/RunnableMapNamesForTesting.java b/clearing-parent/imdg/src/test/java/ru/spcex/clearing/imdg/structure/RunnableMapNamesForTesting.java index 0ce9ebe55..91be28f0a 100644 --- a/clearing-parent/imdg/src/test/java/ru/spcex/clearing/imdg/structure/RunnableMapNamesForTesting.java +++ b/clearing-parent/imdg/src/test/java/ru/spcex/clearing/imdg/structure/RunnableMapNamesForTesting.java @@ -163,5 +163,6 @@ public class RunnableMapNamesForTesting { businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_Session, Session.class)); businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_UserRoleSession, UserRoleSession.class)); businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_UserSettings, UserSettings.class)); + businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_STrade, STrade.class)); } } diff --git a/platform-parent/platform-imdg-api/src/main/java/ru/spcex/clearing/imdg/IMDGDistributedNames.java b/platform-parent/platform-imdg-api/src/main/java/ru/spcex/clearing/imdg/IMDGDistributedNames.java index f4773bb43..149c793b2 100644 --- a/platform-parent/platform-imdg-api/src/main/java/ru/spcex/clearing/imdg/IMDGDistributedNames.java +++ b/platform-parent/platform-imdg-api/src/main/java/ru/spcex/clearing/imdg/IMDGDistributedNames.java @@ -121,6 +121,7 @@ public final class IMDGDistributedNames { public static final String Map_ContractRegister = "Map_ContractRegister"; public static final String Map_OrderRegister = "Map_OrderRegister"; public static final String Map_VerificationResult = "Map_VerificationResult"; + public static final String Map_STrade = "Map_STrade"; public static final String MAP_SEQUENCE_NAME = "MAP_SEQUENCE_NAME";