Merge branch 'imdg_refactoring' into dev
# Conflicts: # clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/config/PoolMapConfigs.java # platform-parent/platform-imdg-api/src/main/java/ru/spcex/clearing/imdg/IMDGDistributedNames.java
This commit is contained in:
commit
e19661b449
18 changed files with 595 additions and 203 deletions
|
|
@ -55,7 +55,6 @@ public class CompanyBackendGetAll extends BasicSpcexResponse {
|
|||
CompanyInfo profile = company.getProfile();
|
||||
companyInfoFields.setId(profile.getId());
|
||||
companyInfoFields.setCompanyId(profile.getCompanyId());
|
||||
companyInfoFields.setClearingMemberCategory(profile.getClearingMemberCategory());
|
||||
companyInfoFields.setCorporationSoleType(profile.getCorporationSoleType());
|
||||
companyInfoFields.setCountryCode(profile.getCountryCode());
|
||||
companyInfoFields.setDescription(profile.getDescription());
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ public class CompanyBackendInfoGetAll extends BasicSpcexResponse {
|
|||
var singleItem = new CompanyBackendInfoGetFields();
|
||||
singleItem.setId(companyInfo.getId());
|
||||
singleItem.setCompanyId(companyInfo.getCompanyId());
|
||||
singleItem.setClearingMemberCategory(companyInfo.getClearingMemberCategory());
|
||||
singleItem.setCorporationSoleType(companyInfo.getCorporationSoleType());
|
||||
singleItem.setCountryCode(companyInfo.getCountryCode());
|
||||
singleItem.setDescription(companyInfo.getDescription());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,187 @@
|
|||
package ru.clearing.classes.statics.data.account;
|
||||
|
||||
import ru.clearing.classes.ConstSerializable;
|
||||
import ru.clearing.classes.objects.BusinessObject;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* Счета
|
||||
* <p>
|
||||
* DB table: ACCOUNT_BALANCE
|
||||
**/
|
||||
public class AccountBalance extends BusinessObject {
|
||||
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
||||
private Long companyId;
|
||||
private Long accountId;
|
||||
private Long accountType;
|
||||
private String account;
|
||||
private BigDecimal openBalanceAmount;
|
||||
private BigDecimal startBalanceAmount;
|
||||
private BigDecimal closeBalanceAmount;
|
||||
private BigDecimal tradeBalanceAmount;
|
||||
private BigDecimal freeBalanceAmount;
|
||||
private BigDecimal changeBalanceAmount;
|
||||
private BigDecimal creditAmount;
|
||||
private BigDecimal debitAmount;
|
||||
private BigDecimal balanceAmount;
|
||||
private String balanceAccountType;
|
||||
private LocalDate clearingDate;
|
||||
private String currencyCode;
|
||||
private String tradingCode;
|
||||
private String shortName;
|
||||
private String fullName;
|
||||
|
||||
public Long getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(Long companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public Long getAccountId() {
|
||||
return accountId;
|
||||
}
|
||||
|
||||
public void setAccountId(Long accountId) {
|
||||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
public Long getAccountType() {
|
||||
return accountType;
|
||||
}
|
||||
|
||||
public void setAccountType(Long accountType) {
|
||||
this.accountType = accountType;
|
||||
}
|
||||
|
||||
public String getAccount() {
|
||||
return account;
|
||||
}
|
||||
|
||||
public void setAccount(String account) {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public BigDecimal getOpenBalanceAmount() {
|
||||
return openBalanceAmount;
|
||||
}
|
||||
|
||||
public void setOpenBalanceAmount(BigDecimal openBalanceAmount) {
|
||||
this.openBalanceAmount = openBalanceAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getStartBalanceAmount() {
|
||||
return startBalanceAmount;
|
||||
}
|
||||
|
||||
public void setStartBalanceAmount(BigDecimal startBalanceAmount) {
|
||||
this.startBalanceAmount = startBalanceAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getCloseBalanceAmount() {
|
||||
return closeBalanceAmount;
|
||||
}
|
||||
|
||||
public void setCloseBalanceAmount(BigDecimal closeBalanceAmount) {
|
||||
this.closeBalanceAmount = closeBalanceAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getTradeBalanceAmount() {
|
||||
return tradeBalanceAmount;
|
||||
}
|
||||
|
||||
public void setTradeBalanceAmount(BigDecimal tradeBalanceAmount) {
|
||||
this.tradeBalanceAmount = tradeBalanceAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getFreeBalanceAmount() {
|
||||
return freeBalanceAmount;
|
||||
}
|
||||
|
||||
public void setFreeBalanceAmount(BigDecimal freeBalanceAmount) {
|
||||
this.freeBalanceAmount = freeBalanceAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getChangeBalanceAmount() {
|
||||
return changeBalanceAmount;
|
||||
}
|
||||
|
||||
public void setChangeBalanceAmount(BigDecimal changeBalanceAmount) {
|
||||
this.changeBalanceAmount = changeBalanceAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getCreditAmount() {
|
||||
return creditAmount;
|
||||
}
|
||||
|
||||
public void setCreditAmount(BigDecimal creditAmount) {
|
||||
this.creditAmount = creditAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getDebitAmount() {
|
||||
return debitAmount;
|
||||
}
|
||||
|
||||
public void setDebitAmount(BigDecimal debitAmount) {
|
||||
this.debitAmount = debitAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getBalanceAmount() {
|
||||
return balanceAmount;
|
||||
}
|
||||
|
||||
public void setBalanceAmount(BigDecimal balanceAmount) {
|
||||
this.balanceAmount = balanceAmount;
|
||||
}
|
||||
|
||||
public String getBalanceAccountType() {
|
||||
return balanceAccountType;
|
||||
}
|
||||
|
||||
public void setBalanceAccountType(String balanceAccountType) {
|
||||
this.balanceAccountType = balanceAccountType;
|
||||
}
|
||||
|
||||
public LocalDate getClearingDate() {
|
||||
return clearingDate;
|
||||
}
|
||||
|
||||
public void setClearingDate(LocalDate clearingDate) {
|
||||
this.clearingDate = clearingDate;
|
||||
}
|
||||
|
||||
public String getCurrencyCode() {
|
||||
return currencyCode;
|
||||
}
|
||||
|
||||
public void setCurrencyCode(String currencyCode) {
|
||||
this.currencyCode = currencyCode;
|
||||
}
|
||||
|
||||
public String getTradingCode() {
|
||||
return tradingCode;
|
||||
}
|
||||
|
||||
public void setTradingCode(String tradingCode) {
|
||||
this.tradingCode = tradingCode;
|
||||
}
|
||||
|
||||
public String getShortName() {
|
||||
return shortName;
|
||||
}
|
||||
|
||||
public void setShortName(String shortName) {
|
||||
this.shortName = shortName;
|
||||
}
|
||||
|
||||
public String getFullName() {
|
||||
return fullName;
|
||||
}
|
||||
|
||||
public void setFullName(String fullName) {
|
||||
this.fullName = fullName;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package ru.clearing.classes.statics.data.account;
|
||||
|
||||
import ru.clearing.classes.ConstSerializable;
|
||||
import ru.clearing.classes.objects.BusinessEvent;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* Изменение состояния объекта Счета
|
||||
* <p>
|
||||
* DB table: ACCOUNT_BALANCE_HISTORY
|
||||
**/
|
||||
public class AccountBalanceHistory extends BusinessEvent<AccountBalance> {
|
||||
@Serial
|
||||
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
||||
|
||||
private AccountBalance object;
|
||||
|
||||
@Override
|
||||
public AccountBalance getObject() {
|
||||
return object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setObject(AccountBalance object) {
|
||||
this.object = object;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
package ru.clearing.classes.statics.data.company;
|
||||
|
||||
import ru.clearing.classes.ConstSerializable;
|
||||
import ru.clearing.classes.statics.data.profile.CompanyInfo;
|
||||
import ru.clearing.classes.objects.BusinessObject;
|
||||
import ru.clearing.classes.statics.data.profile.CompanyInfo;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
package ru.clearing.classes.statics.data.misc;
|
||||
|
||||
import ru.clearing.classes.ConstSerializable;
|
||||
import ru.clearing.classes.objects.BusinessObject;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalTime;
|
||||
|
||||
/**
|
||||
* Счета
|
||||
* <p>
|
||||
* DB table: ADMITTED_DEAL
|
||||
**/
|
||||
public class AdmittedDeal extends BusinessObject {
|
||||
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
||||
|
||||
private String companyFullName;
|
||||
private Instant executionDepositRegisterTradingDate;
|
||||
private String exchangeExecutionId;
|
||||
private LocalTime exchangeExecutionTime;
|
||||
private Long securityShortName;
|
||||
private String sellerFullName;
|
||||
private String sellerClearingCode;
|
||||
private String sellerAccount;
|
||||
private String buyerFullName;
|
||||
private String buyerClearingCode;
|
||||
private String buyerAccount;
|
||||
private BigDecimal executionDepositRegisterAmount;
|
||||
}
|
||||
|
|
@ -10,7 +10,6 @@ public class CompanyInfo extends SpcexObjectBase {
|
|||
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
|
||||
|
||||
private Long companyId; // Company.CompanyInfo.companyId = CompanyInfo.id
|
||||
private String clearingMemberCategory; // ref CHAR(4),
|
||||
private String corporationSoleType; // ref CHAR(4),
|
||||
private String countryCode; //ref CHAR(4),
|
||||
private String description;
|
||||
|
|
@ -34,14 +33,6 @@ public class CompanyInfo extends SpcexObjectBase {
|
|||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public String getClearingMemberCategory() {
|
||||
return clearingMemberCategory;
|
||||
}
|
||||
|
||||
public void setClearingMemberCategory(String clearingMemberCategory) {
|
||||
this.clearingMemberCategory = clearingMemberCategory;
|
||||
}
|
||||
|
||||
public String getCorporationSoleType() {
|
||||
return corporationSoleType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,70 @@
|
|||
package ru.spcex.clearing.imdg;
|
||||
|
||||
import com.hazelcast.config.MapStoreConfig;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import ru.spcex.clearing.imdg.base.BusinessObjectMapStore;
|
||||
import ru.spcex.clearing.imdg.base.DictionaryMapStore;
|
||||
import ru.spcex.clearing.imdg.base.TemplateEventMapStore;
|
||||
import ru.spcex.clearing.imdg.base.TemplateMapStore;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootApplication
|
||||
public class IMDGApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplicationBuilder builder = new SpringApplicationBuilder(IMDGApplication.class);
|
||||
ConfigurableApplicationContext configurableApplicationContext = builder.run(args);
|
||||
tmpLogUncompletedMapStores(configurableApplicationContext);
|
||||
}
|
||||
|
||||
public static void tmpLogUncompletedMapStores(ConfigurableApplicationContext configurableApplicationContext) {
|
||||
try {
|
||||
SpringApplicationBuilder builder = new SpringApplicationBuilder(IMDGApplication.class);
|
||||
builder.run(args);
|
||||
} catch (Throwable e) {
|
||||
//Поиск таблиц которым нужно добавить mapStore и вывод результата в консоль
|
||||
List<String> nameTables = new ArrayList<>();
|
||||
Connection jdbcConnection = DriverManager.getConnection("jdbc:postgresql://10.200.200.133:5432/postgres", "clearing", "Aa111111");
|
||||
DatabaseMetaData md = jdbcConnection.getMetaData();
|
||||
ResultSet rs = md.getTables(null, "clearing", "%", new String[]{"TABLE"});
|
||||
while (rs.next()) {
|
||||
nameTables.add(rs.getString(3));
|
||||
}
|
||||
|
||||
HazelcastInstance hazelcastInstance = configurableApplicationContext.getBean(HazelcastInstance.class);
|
||||
hazelcastInstance.getMap("");
|
||||
for (String mapName : hazelcastInstance.getConfig().getMapConfigs().keySet()) {
|
||||
MapStoreConfig mapStoreConfig = hazelcastInstance.getConfig().getMapConfig(mapName).getMapStoreConfig();
|
||||
Object mapStore = mapStoreConfig.getImplementation();
|
||||
String tableName;
|
||||
if (mapStore instanceof TemplateMapStore) {
|
||||
tableName = ((TemplateMapStore<?>) mapStore).getTableName();
|
||||
} else if (mapStore instanceof DictionaryMapStore) {
|
||||
tableName = ((DictionaryMapStore<?>) mapStore).getTableName();
|
||||
} else if (mapStore instanceof TemplateEventMapStore) {
|
||||
tableName = ((TemplateEventMapStore<?>) mapStore).getTableName();
|
||||
} else if (mapStore instanceof BusinessObjectMapStore) {
|
||||
tableName = ((BusinessObjectMapStore<?>) mapStore).getTableName();
|
||||
} else if (mapName.equals("default")) {
|
||||
continue;
|
||||
} else {
|
||||
System.out.println(mapStore == null ? "Не получилось сопоставить mapStore: is null" : "Не получилось сопоставить: " + mapStore.getClass() + " с таблицей");
|
||||
continue;
|
||||
}
|
||||
nameTables.remove(tableName.toLowerCase());
|
||||
}
|
||||
System.out.println("** Результата поиска таблиц которым нужно добавить mapStore **");
|
||||
nameTables.forEach(System.out::println);
|
||||
System.out.println("**************************************************************");
|
||||
} catch (
|
||||
Throwable e) {
|
||||
LoggerFactory.getLogger(IMDGApplication.class).error("STORAGE start failed: {} -> {}", e.getClass().getSimpleName(), e.getMessage());
|
||||
System.exit(-1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ public abstract class BusinessObjectMapStore<T extends BusinessObject> extends O
|
|||
}
|
||||
|
||||
protected void fillBusinessObjectFields(BusinessObject businessObject, ResultSet rs, String idName) throws SQLException {
|
||||
businessObject.setUpdated(getInstantFromTimestamp(rs, "updated"));
|
||||
businessObject.setCreated(getInstantFromTimestamp(rs, "created"));
|
||||
businessObject.setUpdated(getInstantFromTimestamp(rs, "updated_at"));
|
||||
businessObject.setCreated(getInstantFromTimestamp(rs, "created_at"));
|
||||
businessObject.setId(getLong(rs, idName));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
package ru.spcex.clearing.imdg.businessevent;
|
||||
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.clearing.classes.statics.data.account.AccountBalance;
|
||||
import ru.clearing.classes.statics.data.account.AccountBalanceHistory;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.imdg.base.TemplateEventMapStore;
|
||||
import ru.spcex.platform.utils.time.TimeUtil;
|
||||
|
||||
@Component
|
||||
public class AccountBalanceHistoryMapStore extends TemplateEventMapStore<AccountBalanceHistory> {
|
||||
|
||||
public AccountBalanceHistoryMapStore(JdbcTemplate jdbcTemplate) {
|
||||
super(jdbcTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMapName() {
|
||||
return IMDGDistributedNames.Map_AccountBalanceHistory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableName() {
|
||||
return "ACCOUNT_BALANCE_HISTORY";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFields() {
|
||||
return new String[]{"ID", "EVENT_TIME", "EVENT_USER_ID",
|
||||
"ACCOUNT_BALANCE_ID", "COMPANY_ID", "CREATED_AT", "UPDATED_AT", "ACCOUNT_ID", "ACCOUNT_TYPE",
|
||||
"ACCOUNT", "OPEN_BALANCE_AMOUNT", "START_BALANCE_AMOUNT", "CLOSE_BALANCE_AMOUNT",
|
||||
"TRADE_BALANCE_AMOUNT", "FREE_BALANCE_AMOUNT", "CHANGE_BALANCE_AMOUNT",
|
||||
"CREDIT_AMOUNT", "DEBIT_AMOUNT", "BALANCE_AMOUNT", "BALANCE_ACCOUNT_TYPE",
|
||||
"CLEARING_DATE", "CURRENCY_CODE", "TRADING_CODE", "SHORT_NAME", "FULL_NAME"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] objectToField(AccountBalanceHistory updateLog) {
|
||||
AccountBalance object = updateLog.getObject();
|
||||
Object[] args = new Object[]{
|
||||
updateLog.getId(),
|
||||
updateLog.getEventTime(),
|
||||
updateLog.getUserId(),
|
||||
|
||||
object.getId(),
|
||||
object.getCompanyId(),
|
||||
TimeUtil.toDateFromInstant(object.getCreated()),
|
||||
TimeUtil.toDateFromInstant(object.getUpdated()),
|
||||
object.getAccountId(),
|
||||
object.getAccountType(),
|
||||
object.getAccount(),
|
||||
object.getOpenBalanceAmount(),
|
||||
object.getStartBalanceAmount(),
|
||||
object.getCloseBalanceAmount(),
|
||||
object.getTradeBalanceAmount(),
|
||||
object.getFreeBalanceAmount(),
|
||||
object.getChangeBalanceAmount(),
|
||||
object.getCreditAmount(),
|
||||
object.getDebitAmount(),
|
||||
object.getBalanceAmount(),
|
||||
object.getBalanceAccountType(),
|
||||
TimeUtil.toDateFromLocalDate(object.getClearingDate()),
|
||||
object.getCurrencyCode(),
|
||||
object.getTradingCode(),
|
||||
object.getShortName(),
|
||||
object.getFullName()
|
||||
};
|
||||
return args;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -29,16 +29,16 @@ public class CompanyHistoryMapStore extends BusinessEventMapStore<CompanyHistory
|
|||
public String[] getFields() {
|
||||
return new String[]{
|
||||
"id", "event_time", "event_user_id",
|
||||
"company_id", "created_at", "updated_at", "trading_code", "clearing_code", "registration_code", "workflow_status", "short_name", "full_name"
|
||||
"company_id", "created_at", "updated_at", "trading_code", "clearing_code", "registration_code", "workflow_status", "short_name", "full_name"
|
||||
};
|
||||
}
|
||||
|
||||
public String[] getFieldsForCompanyInfo() {
|
||||
return new String[]{
|
||||
"id", "event_time", "event_user_id",
|
||||
"company_info_id", "company_id", "clearing_member_category", "corporation_sole_type", "country_code", "description",
|
||||
"company_info_id", "company_id", "corporation_sole_type", "country_code", "description",
|
||||
"professional_sign", "legal_kind", "organization_type", "residence", "short_name", "full_name",
|
||||
"short_name_eng", "full_name_eng", "trading_code", "clearing_code", "registration_code"
|
||||
"short_name_eng", "full_name_eng", "trading_code", "clearing_code", "registration_code"
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ public class CompanyHistoryMapStore extends BusinessEventMapStore<CompanyHistory
|
|||
* Перечисление значений полей CompanyInfo.
|
||||
* См. insertCompanyInfoStatement
|
||||
*
|
||||
* @param companyInfo должен быть заполнен id, company_id = company.id
|
||||
* @param companyInfo должен быть заполнен id, company_id = company.id
|
||||
* @return
|
||||
*/
|
||||
protected List<Object> companyInfoToSQLArgs(@NonNull CompanyInfo companyInfo, CompanyHistory rootUpdate) {
|
||||
|
|
@ -97,7 +97,6 @@ public class CompanyHistoryMapStore extends BusinessEventMapStore<CompanyHistory
|
|||
|
||||
companyInfo.getId(), // company_info_id
|
||||
companyInfo.getCompanyId(),
|
||||
companyInfo.getClearingMemberCategory(),
|
||||
companyInfo.getCorporationSoleType(),
|
||||
companyInfo.getCountryCode(),
|
||||
companyInfo.getDescription(),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,99 @@
|
|||
package ru.spcex.clearing.imdg.businessobject;
|
||||
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.clearing.classes.statics.data.account.AccountBalance;
|
||||
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;
|
||||
|
||||
@Component
|
||||
public class AccountBalanceMapStore extends TemplateMapStore<AccountBalance> {
|
||||
|
||||
public AccountBalanceMapStore(JdbcTemplate jdbcTemplate) {
|
||||
super(jdbcTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMapName() {
|
||||
return IMDGDistributedNames.Map_AccountBalance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableName() {
|
||||
return "ACCOUNT_BALANCE";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFields() {
|
||||
return new String[]{
|
||||
"ID", "COMPANY_ID", "CREATED_AT", "UPDATED_AT", "ACCOUNT_ID", "ACCOUNT_TYPE",
|
||||
"ACCOUNT", "OPEN_BALANCE_AMOUNT", "START_BALANCE_AMOUNT", "CLOSE_BALANCE_AMOUNT",
|
||||
"TRADE_BALANCE_AMOUNT", "FREE_BALANCE_AMOUNT", "CHANGE_BALANCE_AMOUNT",
|
||||
"CREDIT_AMOUNT", "DEBIT_AMOUNT", "BALANCE_AMOUNT", "BALANCE_ACCOUNT_TYPE",
|
||||
"CLEARING_DATE", "CURRENCY_CODE", "TRADING_CODE", "SHORT_NAME", "FULL_NAME"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountBalance objectReader(ResultSet resultSet) throws SQLException {
|
||||
AccountBalance object = new AccountBalance();
|
||||
object.setId(resultSet.getObject("ID", Long.class));
|
||||
object.setCompanyId(resultSet.getObject("COMPANY_ID", Long.class));
|
||||
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
|
||||
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
|
||||
object.setAccountId(resultSet.getObject("ACCOUNT_ID", Long.class));
|
||||
object.setAccountType(resultSet.getObject("ACCOUNT_TYPE", Long.class));
|
||||
object.setAccount(resultSet.getObject("ACCOUNT", String.class));
|
||||
object.setOpenBalanceAmount(resultSet.getObject("OPEN_BALANCE_AMOUNT", BigDecimal.class));
|
||||
object.setStartBalanceAmount(resultSet.getObject("START_BALANCE_AMOUNT", BigDecimal.class));
|
||||
object.setCloseBalanceAmount(resultSet.getObject("CLOSE_BALANCE_AMOUNT", BigDecimal.class));
|
||||
object.setTradeBalanceAmount(resultSet.getObject("TRADE_BALANCE_AMOUNT", BigDecimal.class));
|
||||
object.setFreeBalanceAmount(resultSet.getObject("FREE_BALANCE_AMOU", BigDecimal.class));
|
||||
object.setChangeBalanceAmount(resultSet.getObject("CHANGE_BALANCE_AMOUNT", BigDecimal.class));
|
||||
object.setCreditAmount(resultSet.getObject("CREDIT_AMOUNT", BigDecimal.class));
|
||||
object.setDebitAmount(resultSet.getObject("DEBIT_AMOUNT", BigDecimal.class));
|
||||
object.setBalanceAmount(resultSet.getObject("BALANCE_AMOUNT", BigDecimal.class));
|
||||
object.setBalanceAccountType(resultSet.getObject("BALANCE_ACCOUNT_TYPE", String.class));
|
||||
object.setClearingDate(getLocalDateFromSqlDate(resultSet, "CLEARING_DATE"));
|
||||
object.setCurrencyCode(resultSet.getObject("CURRENCY_CODE", String.class));
|
||||
object.setTradingCode(resultSet.getObject("TRADING_CODE", String.class));
|
||||
object.setShortName(resultSet.getObject("SHORT_NAME", String.class));
|
||||
object.setFullName(resultSet.getObject("FULL_NAME", String.class));
|
||||
return object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] objectToField(AccountBalance object) {
|
||||
Object[] args = new Object[]{
|
||||
object.getId(),
|
||||
object.getCompanyId(),
|
||||
TimeUtil.toDateFromInstant(object.getCreated()),
|
||||
TimeUtil.toDateFromInstant(object.getUpdated()),
|
||||
object.getAccountId(),
|
||||
object.getAccountType(),
|
||||
object.getAccount(),
|
||||
object.getOpenBalanceAmount(),
|
||||
object.getStartBalanceAmount(),
|
||||
object.getCloseBalanceAmount(),
|
||||
object.getTradeBalanceAmount(),
|
||||
object.getFreeBalanceAmount(),
|
||||
object.getChangeBalanceAmount(),
|
||||
object.getCreditAmount(),
|
||||
object.getDebitAmount(),
|
||||
object.getBalanceAmount(),
|
||||
object.getBalanceAccountType(),
|
||||
TimeUtil.toDateFromLocalDate(object.getClearingDate()),
|
||||
object.getCurrencyCode(),
|
||||
object.getTradingCode(),
|
||||
object.getShortName(),
|
||||
object.getFullName()
|
||||
};
|
||||
return args;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -14,6 +14,9 @@ import java.util.*;
|
|||
@Component
|
||||
public class CompanyMapStore extends BusinessObjectMapStore<Company> {
|
||||
|
||||
protected final String insertStatement = makeInsertSql(getTableName(), getFields(), "id");
|
||||
protected final String insertCompanyInfoStatement = makeInsertSql("COMPANY_INFO", getFieldsForCompanyInfo(), "id");
|
||||
|
||||
public CompanyMapStore(JdbcTemplate jdbcTemplate) {
|
||||
super(jdbcTemplate);
|
||||
}
|
||||
|
|
@ -26,21 +29,18 @@ public class CompanyMapStore extends BusinessObjectMapStore<Company> {
|
|||
@Override
|
||||
public String[] getFields() {
|
||||
return new String[]{
|
||||
"id", "created_at", "updated_at", "trading_code", "clearing_code", "registration_code", "workflow_status", "short_name", "full_name"
|
||||
"id", "created_at", "updated_at", "trading_code", "clearing_code", "registration_code", "workflow_status", "short_name", "full_name"
|
||||
};
|
||||
}
|
||||
|
||||
public String[] getFieldsForCompanyInfo() {
|
||||
return new String[]{
|
||||
"id", "company_id", "clearing_member_category", "corporation_sole_type", "country_code", "description",
|
||||
"id", "company_id", "corporation_sole_type", "country_code", "description",
|
||||
"professional_sign", "legal_kind", "organization_type", "residence", "short_name", "full_name",
|
||||
"short_name_eng", "full_name_eng", "trading_code", "clearing_code", "registration_code"
|
||||
"short_name_eng", "full_name_eng", "trading_code", "clearing_code", "registration_code"
|
||||
};
|
||||
}
|
||||
|
||||
protected final String insertStatement = makeInsertSql(getTableName(), getFields(), "id");
|
||||
protected final String insertCompanyInfoStatement = makeInsertSql("COMPANY_INFO", getFieldsForCompanyInfo(), "id");
|
||||
|
||||
@Override
|
||||
public Collection<Company> load(Collection<Long> keys) {
|
||||
Map<String, Collection<Long>> paramMap = Collections.singletonMap("ids", keys);
|
||||
|
|
@ -103,19 +103,18 @@ public class CompanyMapStore extends BusinessObjectMapStore<Company> {
|
|||
(rs, rowNum) -> {
|
||||
CompanyInfo companyInfo = new CompanyInfo();
|
||||
companyInfo.setId(rs.getObject("Id", Long.class));
|
||||
companyInfo.setCompanyId(rs.getObject("CompanyId", Long.class));
|
||||
companyInfo.setClearingMemberCategory(rs.getString("ClearingMemberCategory"));
|
||||
companyInfo.setCorporationSoleType(rs.getString("CorporationSoleType"));
|
||||
companyInfo.setCountryCode(rs.getString("CountryCode"));
|
||||
companyInfo.setDescription(rs.getString("Description"));
|
||||
companyInfo.setProfessionalSign(rs.getString("ProfessionalSign"));
|
||||
companyInfo.setLegalKind(rs.getString("LegalKind"));
|
||||
companyInfo.setOrganizationType(rs.getString("OrganizationType"));
|
||||
companyInfo.setResidence(rs.getString("Residence"));
|
||||
companyInfo.setShortName(rs.getString("ShortName"));
|
||||
companyInfo.setFullName(rs.getString("FullName"));
|
||||
companyInfo.setShortNameEng(rs.getString("ShortNameEng"));
|
||||
companyInfo.setFullNameEng(rs.getString("FullNameEng"));
|
||||
companyInfo.setCompanyId(rs.getObject("COMPANY_ID", Long.class));
|
||||
companyInfo.setCorporationSoleType(rs.getString("CORPORATION_SOLE_TYPE"));
|
||||
companyInfo.setCountryCode(rs.getString("COUNTRY_CODE"));
|
||||
companyInfo.setDescription(rs.getString("DESCRIPTION"));
|
||||
companyInfo.setProfessionalSign(rs.getString("PROFESSIONAL_SIGN"));
|
||||
companyInfo.setLegalKind(rs.getString("LEGAL_KIND"));
|
||||
companyInfo.setOrganizationType(rs.getString("ORGANIZATION_TYPE"));
|
||||
companyInfo.setResidence(rs.getString("RESIDENCE"));
|
||||
companyInfo.setShortName(rs.getString("SHORT_NAME"));
|
||||
companyInfo.setFullName(rs.getString("FULL_NAME"));
|
||||
companyInfo.setShortNameEng(rs.getString("SHORT_NAME_ENG"));
|
||||
companyInfo.setFullNameEng(rs.getString("FULL_NAME_ENG"));
|
||||
companyInfo.setTradingCode(rs.getObject("TRADING_CODE", String.class));
|
||||
companyInfo.setClearingCode(rs.getObject("CLEARING_CODE", String.class));
|
||||
companyInfo.setRegistrationCode(rs.getObject("REGISTRATION_CODE", String.class));
|
||||
|
|
@ -135,14 +134,13 @@ public class CompanyMapStore extends BusinessObjectMapStore<Company> {
|
|||
* Перечисление значений полей CompanyInfo.
|
||||
* См. insertCompanyInfoStatement
|
||||
*
|
||||
* @param companyInfo должен быть заполнен id, company_id = company.id
|
||||
* @param companyInfo должен быть заполнен id, company_id = company.id
|
||||
* @return
|
||||
*/
|
||||
protected List<Object> companyInfoToSQLArgs(@NonNull CompanyInfo companyInfo) {
|
||||
List<Object> companyInfoArgs = new ArrayList<>(Arrays.asList(
|
||||
companyInfo.getId(),
|
||||
companyInfo.getCompanyId(),
|
||||
companyInfo.getClearingMemberCategory(),
|
||||
companyInfo.getCorporationSoleType(),
|
||||
companyInfo.getCountryCode(),
|
||||
companyInfo.getDescription(),
|
||||
|
|
@ -157,7 +155,7 @@ public class CompanyMapStore extends BusinessObjectMapStore<Company> {
|
|||
companyInfo.getTradingCode(),
|
||||
companyInfo.getClearingCode(),
|
||||
companyInfo.getRegistrationCode()
|
||||
));
|
||||
));
|
||||
return companyInfoArgs;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,47 +178,4 @@ public class PoolMapConfigs {
|
|||
log.debug("Configured {} mapStore's", out.size());
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
private CompanySymbolsMapStore companySymbolsMapStore;
|
||||
|
||||
public MapConfig map_CompanySymbols() {
|
||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_CompanySymbols, companySymbolsMapStore)
|
||||
.addMapIndexConfig(makeMapIndexConfig("companyId"))
|
||||
.addMapIndexConfig(makeMapIndexConfig("companySymbol"));
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
private ProfileDocumentMapStore profileDocumentMapStore;
|
||||
|
||||
public MapConfig map_ProfileDocument() {
|
||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_ProfileDocument, profileDocumentMapStore)
|
||||
.addMapIndexConfig(makeMapIndexConfig("companyId"));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ContactMapStore contactMapStore;
|
||||
|
||||
public MapConfig map_Contact() {
|
||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_Contact, contactMapStore)
|
||||
.addMapIndexConfig(makeMapIndexConfig("companyId"));
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
private CompanyMapStore companyMapStore;
|
||||
|
||||
public MapConfig map_Company() {
|
||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_Company, companyMapStore);
|
||||
// .addMapIndexConfig(makeMapIndexConfig("companyId"));
|
||||
}
|
||||
|
||||
// @Autowired
|
||||
private CompanyHistoryMapStore companyHistoryMapStore;
|
||||
|
||||
public MapConfig map_CompanyUpdate() {
|
||||
return makeDefaultMapConfig(IMDGDistributedNames.Map_CompanyHistory, companyHistoryMapStore);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,17 +3,24 @@ package ru.spcex.clearing.imdg.object;
|
|||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.clearing.classes.statics.data.company.CompanySymbols;
|
||||
import ru.spcex.clearing.imdg.base.ObjectBaseMapStore;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.imdg.base.TemplateMapStore;
|
||||
|
||||
import java.util.*;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
@Component
|
||||
public class CompanySymbolsMapStore extends ObjectBaseMapStore<CompanySymbols> {
|
||||
public class CompanySymbolsMapStore extends TemplateMapStore<CompanySymbols> {
|
||||
|
||||
public CompanySymbolsMapStore(JdbcTemplate jdbcTemplate) {
|
||||
super(jdbcTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMapName() {
|
||||
return IMDGDistributedNames.Map_CompanySymbols;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableName() {
|
||||
return "COMPANY_SYMBOLS";
|
||||
|
|
@ -26,38 +33,24 @@ public class CompanySymbolsMapStore extends ObjectBaseMapStore<CompanySymbols> {
|
|||
};
|
||||
}
|
||||
|
||||
protected final String insertStatement = makeInsertSql(getTableName(), getFields(), "id");
|
||||
|
||||
@Override
|
||||
public Collection<CompanySymbols> load(Collection<Long> keys) {
|
||||
Map<String, Collection<Long>> paramMap = Collections.singletonMap("ids", keys);
|
||||
return namedParameterJdbcTemplate.query("select * from " + getTableName() + " where id in (:ids)", paramMap,
|
||||
(resultSet, i) -> {
|
||||
CompanySymbols companySymbols = new CompanySymbols();
|
||||
companySymbols.setId(resultSet.getObject("id", Long.class));
|
||||
companySymbols.setCompanyId(resultSet.getObject("companyid", Long.class));
|
||||
companySymbols.setCompanySymbol(resultSet.getObject("companysymbol", String.class));
|
||||
companySymbols.setCompanySymbolValue(resultSet.getObject("companysymbolvalue", String.class));
|
||||
return companySymbols;
|
||||
});
|
||||
protected CompanySymbols objectReader(ResultSet resultSet) throws SQLException {
|
||||
CompanySymbols object = new CompanySymbols();
|
||||
object.setId(resultSet.getObject("id", Long.class));
|
||||
object.setCompanyId(resultSet.getObject("companyid", Long.class));
|
||||
object.setCompanySymbol(resultSet.getObject("companysymbol", String.class));
|
||||
object.setCompanySymbolValue(resultSet.getObject("companysymbolvalue", String.class));
|
||||
return object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void store(Map<Long, CompanySymbols> map) {
|
||||
List<Object[]> batchArgs = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<Long, CompanySymbols> entry : map.entrySet()) {
|
||||
CompanySymbols companySymbols = entry.getValue();
|
||||
|
||||
Object[] args = new Object[]{
|
||||
companySymbols.getId(),
|
||||
companySymbols.getCompanyId(),
|
||||
companySymbols.getCompanySymbol(),
|
||||
companySymbols.getCompanySymbolValue()
|
||||
};
|
||||
batchArgs.add(args);
|
||||
}
|
||||
batchInsertUpdate(insertStatement, batchArgs);
|
||||
protected Object[] objectToField(CompanySymbols resultSet) {
|
||||
Object[] args = new Object[]{
|
||||
resultSet.getId(),
|
||||
resultSet.getCompanyId(),
|
||||
resultSet.getCompanySymbol(),
|
||||
resultSet.getCompanySymbolValue()
|
||||
};
|
||||
return args;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,17 +3,24 @@ package ru.spcex.clearing.imdg.object;
|
|||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.clearing.classes.statics.data.profile.Contact;
|
||||
import ru.spcex.clearing.imdg.base.ObjectBaseMapStore;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.imdg.base.TemplateMapStore;
|
||||
|
||||
import java.util.*;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
@Component
|
||||
public class ContactMapStore extends ObjectBaseMapStore<Contact> {
|
||||
public class ContactMapStore extends TemplateMapStore<Contact> {
|
||||
|
||||
public ContactMapStore(JdbcTemplate jdbcTemplate) {
|
||||
super(jdbcTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMapName() {
|
||||
return IMDGDistributedNames.Map_Contact;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableName() {
|
||||
return "CONTACT";
|
||||
|
|
@ -26,38 +33,24 @@ public class ContactMapStore extends ObjectBaseMapStore<Contact> {
|
|||
};
|
||||
}
|
||||
|
||||
protected final String insertStatement = makeInsertSql(getTableName(), getFields(), "id");
|
||||
|
||||
@Override
|
||||
public Collection<Contact> load(Collection<Long> keys) {
|
||||
Map<String, Collection<Long>> paramMap = Collections.singletonMap("ids", keys);
|
||||
return namedParameterJdbcTemplate.query("select * from " + getTableName() + " where id in (:ids)", paramMap,
|
||||
(resultSet, i) -> {
|
||||
Contact contact = new Contact();
|
||||
contact.setId(resultSet.getObject("id", Long.class));
|
||||
contact.setCompanyId(resultSet.getObject("company_id", Long.class));
|
||||
contact.setContactType(resultSet.getObject("contact_type", String.class));
|
||||
contact.setContactValue(resultSet.getObject("contact_value", String.class));
|
||||
return contact;
|
||||
});
|
||||
protected Contact objectReader(ResultSet resultSet) throws SQLException {
|
||||
Contact object = new Contact();
|
||||
object.setId(resultSet.getObject("id", Long.class));
|
||||
object.setCompanyId(resultSet.getObject("company_id", Long.class));
|
||||
object.setContactType(resultSet.getObject("contact_type", String.class));
|
||||
object.setContactValue(resultSet.getObject("contact_value", String.class));
|
||||
return object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void store(Map<Long, Contact> map) {
|
||||
List<Object[]> batchArgs = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<Long, Contact> entry : map.entrySet()) {
|
||||
Contact contact = entry.getValue();
|
||||
|
||||
Object[] args = new Object[]{
|
||||
contact.getId(),
|
||||
contact.getCompanyId(),
|
||||
contact.getContactType(),
|
||||
contact.getContactValue()
|
||||
};
|
||||
batchArgs.add(args);
|
||||
}
|
||||
batchInsertUpdate(insertStatement, batchArgs);
|
||||
protected Object[] objectToField(Contact resultSet) {
|
||||
Object[] args = new Object[]{
|
||||
resultSet.getId(),
|
||||
resultSet.getCompanyId(),
|
||||
resultSet.getContactType(),
|
||||
resultSet.getContactValue()
|
||||
};
|
||||
return args;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,18 +3,25 @@ package ru.spcex.clearing.imdg.object;
|
|||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.clearing.classes.statics.data.profile.ProfileDocument;
|
||||
import ru.spcex.clearing.imdg.base.ObjectBaseMapStore;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.imdg.base.TemplateMapStore;
|
||||
import ru.spcex.platform.utils.time.TimeUtil;
|
||||
|
||||
import java.util.*;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
@Component
|
||||
public class ProfileDocumentMapStore extends ObjectBaseMapStore<ProfileDocument> {
|
||||
public class ProfileDocumentMapStore extends TemplateMapStore<ProfileDocument> {
|
||||
|
||||
public ProfileDocumentMapStore(JdbcTemplate jdbcTemplate) {
|
||||
super(jdbcTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMapName() {
|
||||
return IMDGDistributedNames.Map_ProfileDocument;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableName() {
|
||||
return "PROFILE_DOCUMENT";
|
||||
|
|
@ -28,56 +35,42 @@ public class ProfileDocumentMapStore extends ObjectBaseMapStore<ProfileDocument>
|
|||
};
|
||||
}
|
||||
|
||||
protected final String insertStatement = makeInsertSql(getTableName(), getFields(), "id");
|
||||
|
||||
@Override
|
||||
public Collection<ProfileDocument> load(Collection<Long> keys) {
|
||||
Map<String, Collection<Long>> paramMap = Collections.singletonMap("ids", keys);
|
||||
return namedParameterJdbcTemplate.query("select * from " + getTableName() + " where id in (:ids)", paramMap,
|
||||
(resultSet, i) -> {
|
||||
ProfileDocument profileDocument = new ProfileDocument();
|
||||
profileDocument.setId(resultSet.getObject("id", Long.class));
|
||||
profileDocument.setCompanyId(resultSet.getObject("company_id", Long.class));
|
||||
profileDocument.setDocumentType(resultSet.getObject("document_type", String.class));
|
||||
profileDocument.setIssueDate(getInstantFromTimestamp(resultSet,"issue_date"));
|
||||
profileDocument.setIssuePlace(resultSet.getObject("issue_place", String.class));
|
||||
profileDocument.setIssuer(resultSet.getObject("issuer", String.class));
|
||||
profileDocument.setIssuerCode(resultSet.getObject("issuer_code", String.class));
|
||||
profileDocument.setName(resultSet.getObject("name", String.class));
|
||||
profileDocument.setNumber(resultSet.getObject("number", String.class));
|
||||
profileDocument.setPlace(resultSet.getObject("place", String.class));
|
||||
profileDocument.setValidFromDate(getInstantFromTimestamp(resultSet,"valid_from_date"));
|
||||
profileDocument.setValidToDate(getInstantFromTimestamp(resultSet,"valid_to_date"));
|
||||
profileDocument.setLink(resultSet.getObject("LINK", String.class));
|
||||
return profileDocument;
|
||||
});
|
||||
protected ProfileDocument objectReader(ResultSet resultSet) throws SQLException {
|
||||
ProfileDocument object = new ProfileDocument();
|
||||
object.setId(resultSet.getObject("id", Long.class));
|
||||
object.setCompanyId(resultSet.getObject("company_id", Long.class));
|
||||
object.setDocumentType(resultSet.getObject("document_type", String.class));
|
||||
object.setIssueDate(getInstantFromTimestamp(resultSet, "issue_date"));
|
||||
object.setIssuePlace(resultSet.getObject("issue_place", String.class));
|
||||
object.setIssuer(resultSet.getObject("issuer", String.class));
|
||||
object.setIssuerCode(resultSet.getObject("issuer_code", String.class));
|
||||
object.setName(resultSet.getObject("name", String.class));
|
||||
object.setNumber(resultSet.getObject("number", String.class));
|
||||
object.setPlace(resultSet.getObject("place", String.class));
|
||||
object.setValidFromDate(getInstantFromTimestamp(resultSet, "valid_from_date"));
|
||||
object.setValidToDate(getInstantFromTimestamp(resultSet, "valid_to_date"));
|
||||
object.setLink(resultSet.getObject("LINK", String.class));
|
||||
return object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void store(Map<Long, ProfileDocument> map) {
|
||||
List<Object[]> batchArgs = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<Long, ProfileDocument> entry : map.entrySet()) {
|
||||
ProfileDocument profileDocument = entry.getValue();
|
||||
|
||||
Object[] args = new Object[]{
|
||||
profileDocument.getId(),
|
||||
profileDocument.getCompanyId(),
|
||||
profileDocument.getDocumentType(),
|
||||
TimeUtil.toDateFromInstant(profileDocument.getIssueDate()),
|
||||
profileDocument.getIssuePlace(),
|
||||
profileDocument.getIssuer(),
|
||||
profileDocument.getIssuerCode(),
|
||||
profileDocument.getName(),
|
||||
profileDocument.getNumber(),
|
||||
profileDocument.getPlace(),
|
||||
TimeUtil.toDateFromInstant(profileDocument.getValidFromDate()),
|
||||
TimeUtil.toDateFromInstant(profileDocument.getValidToDate()),
|
||||
profileDocument.getLink()
|
||||
};
|
||||
batchArgs.add(args);
|
||||
}
|
||||
batchInsertUpdate(insertStatement, batchArgs);
|
||||
protected Object[] objectToField(ProfileDocument resultSet) {
|
||||
Object[] args = new Object[]{
|
||||
resultSet.getId(),
|
||||
resultSet.getCompanyId(),
|
||||
resultSet.getDocumentType(),
|
||||
TimeUtil.toDateFromInstant(resultSet.getIssueDate()),
|
||||
resultSet.getIssuePlace(),
|
||||
resultSet.getIssuer(),
|
||||
resultSet.getIssuerCode(),
|
||||
resultSet.getName(),
|
||||
resultSet.getNumber(),
|
||||
resultSet.getPlace(),
|
||||
TimeUtil.toDateFromInstant(resultSet.getValidFromDate()),
|
||||
TimeUtil.toDateFromInstant(resultSet.getValidToDate()),
|
||||
resultSet.getLink()
|
||||
};
|
||||
return args;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,11 +8,12 @@ public final class IMDGDistributedNames {
|
|||
public static final String Map_CompanyHistory = "Map_CompanyHistory";
|
||||
public static final String Map_CompanyRoleSet = "Map_CompanyRoleSet";
|
||||
public static final String Map_CompanySymbols = "Map_CompanySymbols";
|
||||
public static final String Map_CompanyInfo = "Map_CompanyInfo";
|
||||
public static final String Map_Contact = "Map_Contact";
|
||||
public static final String Map_ProfileDocument = "Map_ProfileDocument";
|
||||
public static final String Map_Account = "Map_Account";
|
||||
public static final String Map_AccountBalance = "Map_AccountBalance";
|
||||
public static final String Map_AccountHistory = "Map_AccountHistory";
|
||||
public static final String Map_AccountBalanceHistory = "Map_AccountBalanceHistory";
|
||||
public static final String Map_Relation = "Map_Relation";
|
||||
public static final String Map_ClearingAccount = "Map_ClearingAccount";
|
||||
public static final String Map_ClearingAccountHistory = "Map_ClearingAccountHistory";
|
||||
|
|
@ -100,7 +101,6 @@ public final class IMDGDistributedNames {
|
|||
public static final String Map_AccountStatusDictionary = "Map_AccountStatusDictionary";
|
||||
public static final String Map_KeyRate = "Map_KeyRate";
|
||||
public static final String Map_MoneyMarketSecurity = "Map_MoneyMarketSecurity";
|
||||
public static final String Map_AccountBalance = "Map_AccountBalance";
|
||||
public static final String MAP_SEQUENCE_NAME = "MAP_SEQUENCE_NAME"; // todo вынести idGenerator отдельно и завернуть в метод, чтобы не напрямую обращаться.
|
||||
|
||||
private IMDGDistributedNames() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue