registry-service http://jira.mfd.msk:8088/browse/CLS-680 добавил ExecutionCurrency, правки поле
This commit is contained in:
parent
b6f371dfc9
commit
2289d1ed6c
9 changed files with 396 additions and 20 deletions
|
|
@ -0,0 +1,78 @@
|
|||
package ru.spcex.clearing.registry.reports.bean;
|
||||
|
||||
import ru.spcex.clearing.registry.reports.loaders.IDBObject;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class ExecutionCurrency extends ExecutionCommon implements IDBObject {
|
||||
private Long exchangeOrderId;
|
||||
private BigDecimal settlementAmount;
|
||||
private String comment;
|
||||
private Long clientCodeId;
|
||||
private String settlementCode;
|
||||
private LocalDate settlementDate;
|
||||
private Instant exchangeExecutionMicroseconds;
|
||||
|
||||
@Override
|
||||
public ExecutionType type() {
|
||||
return ExecutionType.ExecutionCurrency;
|
||||
}
|
||||
|
||||
public Long getExchangeOrderId() {
|
||||
return exchangeOrderId;
|
||||
}
|
||||
|
||||
public void setExchangeOrderId(Long exchangeOrderId) {
|
||||
this.exchangeOrderId = exchangeOrderId;
|
||||
}
|
||||
|
||||
public BigDecimal getSettlementAmount() {
|
||||
return settlementAmount;
|
||||
}
|
||||
|
||||
public void setSettlementAmount(BigDecimal settlementAmount) {
|
||||
this.settlementAmount = settlementAmount;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public Long getClientCodeId() {
|
||||
return clientCodeId;
|
||||
}
|
||||
|
||||
public void setClientCodeId(Long clientCodeId) {
|
||||
this.clientCodeId = clientCodeId;
|
||||
}
|
||||
|
||||
public String getSettlementCode() {
|
||||
return settlementCode;
|
||||
}
|
||||
|
||||
public void setSettlementCode(String settlementCode) {
|
||||
this.settlementCode = settlementCode;
|
||||
}
|
||||
|
||||
public LocalDate getSettlementDate() {
|
||||
return settlementDate;
|
||||
}
|
||||
|
||||
public void setSettlementDate(LocalDate settlementDate) {
|
||||
this.settlementDate = settlementDate;
|
||||
}
|
||||
|
||||
public Instant getExchangeExecutionMicroseconds() {
|
||||
return exchangeExecutionMicroseconds;
|
||||
}
|
||||
|
||||
public void setExchangeExecutionMicroseconds(Instant exchangeExecutionMicroseconds) {
|
||||
this.exchangeExecutionMicroseconds = exchangeExecutionMicroseconds;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
package ru.spcex.clearing.registry.reports.bean;
|
||||
|
||||
public enum ExecutionType {
|
||||
ExecutionDeposit, ExecutionFond;
|
||||
ExecutionDeposit, ExecutionFond, ExecutionCurrency;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package ru.spcex.clearing.registry.reports.builders;
|
|||
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.registry.reports.bean.ExecutionCommon;
|
||||
import ru.spcex.clearing.registry.reports.bean.ExecutionCurrency;
|
||||
import ru.spcex.clearing.registry.reports.bean.ExecutionDeposit;
|
||||
import ru.spcex.clearing.registry.reports.bean.ExecutionFond;
|
||||
import ru.spcex.clearing.registry.reports.report.ExecutionRegisterReport;
|
||||
|
|
@ -55,6 +56,15 @@ public class ExecutionRegisterReportBuilder extends XLSXReportBuilder<ExecutionR
|
|||
if (fond.getInterestAmount() != null) sum = sum.add(fond.getInterestAmount());
|
||||
entity.setAmount(sum);
|
||||
entity.setQuantity(fond.getQuantity());
|
||||
} else if (input instanceof ExecutionCurrency curr) {
|
||||
entity.setSettlementDate(curr.getSettlementDate());
|
||||
entity.setSecurity(curr.getSecuritySymbol());
|
||||
BigDecimal sum = curr.getSettlementAmount() != null ? curr.getSettlementAmount() : BigDecimal.ZERO;
|
||||
if (curr.getInterestAmount() != null) sum = sum.add(curr.getInterestAmount());
|
||||
entity.setAmount(sum);
|
||||
entity.setQuantity(curr.getQuantity());
|
||||
} else {
|
||||
log.warn("Unsupported report class {}", input);
|
||||
}
|
||||
entity.setStatus(input.getStatus());
|
||||
entity.setMarket(input.getMarket());
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package ru.spcex.clearing.registry.reports.builders;
|
|||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.registry.reports.bean.Registry;
|
||||
import ru.spcex.clearing.registry.reports.report.LiabilitiesRegistryReport;
|
||||
import ru.spcex.platform.enumeration.SessionType;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
|
|
@ -34,8 +35,13 @@ public class LiabilitiesRegistryReportBuilder extends XLSXReportBuilder<Liabilit
|
|||
entity.setSecurity_symbol(input.getSecuritySymbol());
|
||||
entity.setBalance(input.getBalance());
|
||||
entity.setSettlement_date(input.getSettlementDate());
|
||||
entity.setContract(input.getContract());
|
||||
if (!SessionType.CURR.equalsByKey(input.getSessionType())) {
|
||||
entity.setContract(input.getContract());
|
||||
}
|
||||
entity.setSession_type(input.getSessionType_dictionary());
|
||||
if (input.getGroupId() != null) {
|
||||
entity.setExecutionNumber(String.valueOf(input.getGroupId()));
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,262 @@
|
|||
package ru.spcex.clearing.registry.reports.loaders;
|
||||
|
||||
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.registry.conf.properties.AProperties;
|
||||
import ru.spcex.clearing.registry.reports.ReportUtils;
|
||||
import ru.spcex.clearing.registry.reports.bean.*;
|
||||
import ru.spcex.clearing.registry.reports.loaders.helpers.AllowedDictionaryRowMapper;
|
||||
import ru.spcex.clearing.registry.reports.loaders.helpers.CompanyRowMapper;
|
||||
import ru.spcex.clearing.registry.reports.loaders.helpers.CompanySymbolsRowMapper;
|
||||
import ru.spcex.clearing.registry.reports.loaders.helpers.TradingClearingRegistryRowMapper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static ru.spcex.clearing.registry.reports.ReportUtils.getInstantFromTimestamp;
|
||||
import static ru.spcex.clearing.registry.reports.ReportUtils.getLocalDateFromSqlDate;
|
||||
|
||||
@Component
|
||||
public class ExecutionCurrencyLoader extends IDBLoader<ExecutionCurrency> {
|
||||
public ExecutionCurrencyLoader(AProperties properties, NamedParameterJdbcTemplate clearingJdbc) {
|
||||
super(properties.getPeriod(), clearingJdbc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String sqlQuery() {
|
||||
return "select * from EXECUTION_CURRENCY where CLEARING_DATE >= :startDate and CLEARING_DATE < :endDate";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<ExecutionCurrency> getDBObjectClass() {
|
||||
return ExecutionCurrency.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExecutionCurrency> loadObjects() {
|
||||
try {
|
||||
List<ExecutionCurrency> executionCurrencys = super.loadObjects();
|
||||
if (executionCurrencys.isEmpty()) {
|
||||
log.warn("ExecutionCurrency not found.");
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
Map<Long, TradingClearingRegistry> tradingClearingRegistryById = new HashMap<>();
|
||||
{
|
||||
Set<Long> tkrIds = executionCurrencys.stream()
|
||||
.filter(eDep -> eDep.getPartyTradingClearingRegistry() == null) // оптимизация;
|
||||
.map(ExecutionCurrency::getTradingClearingRegistryId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
tkrIds.addAll(executionCurrencys.stream()
|
||||
.filter(eDep -> eDep.getCounterPartyTradingClearingRegistry() == null) // оптимизация
|
||||
.map(ExecutionCurrency::getCounterPartyTradingClearingRegistryId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet()));
|
||||
if (!tkrIds.isEmpty()) {
|
||||
MapSqlParameterSource parameterSource = new MapSqlParameterSource();
|
||||
parameterSource.addValue("ids", tkrIds);
|
||||
List<TradingClearingRegistry> tradingClearingRegistries = clearingJdbc.query(
|
||||
"select ID, CODE from TRADING_CLEARING_REGISTRY where ID in (:ids)",
|
||||
parameterSource, new TradingClearingRegistryRowMapper()
|
||||
);
|
||||
for (TradingClearingRegistry tkr : tradingClearingRegistries) {
|
||||
tradingClearingRegistryById.put(tkr.getId(), tkr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<Long, List<CompanySymbols>> companySymbolsForCompanyIdMap;
|
||||
{
|
||||
Set<Long> companyIds = executionCurrencys.stream().map(ExecutionCurrency::getCompanyId).collect(Collectors.toSet());
|
||||
MapSqlParameterSource parameterSource = new MapSqlParameterSource();
|
||||
parameterSource.addValue("ids", companyIds);
|
||||
parameterSource.addValue("cs", CompanySymbol.CLRC.getKey());
|
||||
List<CompanySymbols> companySymbolsForCompanyId = clearingJdbc.query(
|
||||
"select ID, COMPANY_ID, COMPANY_SYMBOL, COMPANY_SYMBOL_VALUE from COMPANY_SYMBOLS where COMPANY_ID in (:ids) and COMPANY_SYMBOL = :cs",
|
||||
parameterSource, new CompanySymbolsRowMapper()
|
||||
);
|
||||
companySymbolsForCompanyIdMap = companySymbolsForCompanyId.stream().collect(Collectors.groupingBy(CompanySymbols::getCompanyId));
|
||||
}
|
||||
|
||||
Map<Long, List<CompanySymbols>> companySymbolsForCounterPartyIdMap;
|
||||
{
|
||||
Set<Long> counterPartyIds = executionCurrencys.stream().map(ExecutionCurrency::getCounterPartyId).collect(Collectors.toSet());
|
||||
MapSqlParameterSource parameterSource = new MapSqlParameterSource();
|
||||
parameterSource.addValue("ids", counterPartyIds);
|
||||
parameterSource.addValue("companySymbol", CompanySymbol.CLRC.getKey());
|
||||
List<CompanySymbols> companySymbolsForCounterPartyId = clearingJdbc.query(
|
||||
"select ID, COMPANY_ID, COMPANY_SYMBOL, COMPANY_SYMBOL_VALUE from COMPANY_SYMBOLS where COMPANY_ID in (:ids) and COMPANY_SYMBOL = :companySymbol",
|
||||
parameterSource, new CompanySymbolsRowMapper()
|
||||
);
|
||||
companySymbolsForCounterPartyIdMap = companySymbolsForCounterPartyId.stream().collect(Collectors.groupingBy(CompanySymbols::getCompanyId));
|
||||
}
|
||||
|
||||
Map<Long, Company> companyById;
|
||||
{
|
||||
Set<Long> allCompanyIds = Stream.concat(
|
||||
executionCurrencys.stream().map(ExecutionCurrency::getCompanyId),
|
||||
executionCurrencys.stream().map(ExecutionCurrency::getCounterPartyId))
|
||||
.collect(Collectors.toSet());
|
||||
MapSqlParameterSource parameterSource = new MapSqlParameterSource();
|
||||
parameterSource.addValue("ids", allCompanyIds);
|
||||
List<Company> companyForCompanyId = clearingJdbc.query(
|
||||
"select ID, CLEARING_CODE, SHORT_NAME from COMPANY where ID in (:ids)",
|
||||
parameterSource, new CompanyRowMapper()
|
||||
);
|
||||
companyById = companyForCompanyId.stream()
|
||||
.collect(Collectors.toMap(Company::getId, o -> o));
|
||||
}
|
||||
|
||||
Map<String, List<AllowedDictionary>> allowedDictionariesByCode;
|
||||
{
|
||||
Set<String> coverageStatuses = executionCurrencys.stream().map(ExecutionCurrency::getCoverageStatus).collect(Collectors.toSet());
|
||||
MapSqlParameterSource parameterSource = new MapSqlParameterSource();
|
||||
parameterSource.addValue("coverageStatuses", coverageStatuses);
|
||||
List<AllowedDictionary> allowedDictionaries = clearingJdbc.query(
|
||||
"select * from ALLOWED_DICTIONARY where CODE in (:coverageStatuses)",
|
||||
parameterSource, new AllowedDictionaryRowMapper()
|
||||
);
|
||||
allowedDictionariesByCode = allowedDictionaries.stream()
|
||||
.collect(Collectors.groupingBy(AllowedDictionary::getCode));
|
||||
}
|
||||
|
||||
for (ExecutionCurrency executionCurrency : executionCurrencys) {
|
||||
Company companyByCompanyId = companyById.get(executionCurrency.getCompanyId());
|
||||
Company companyByCounterPartyId = companyById.get(executionCurrency.getCounterPartyId());
|
||||
String side = executionCurrency.getSide() == null ? null : executionCurrency.getSide().toUpperCase();
|
||||
if (MoneyFlowSide.SELL.equalsByKey(side) || Side.SELL.equalsByKey(side)) {
|
||||
if (companyByCompanyId != null) {
|
||||
executionCurrency.setSeller(companyByCompanyId.getShortName());
|
||||
}
|
||||
if (companyByCounterPartyId != null) {
|
||||
executionCurrency.setBuyer(companyByCounterPartyId.getShortName());
|
||||
}
|
||||
{
|
||||
List<CompanySymbols> cSymbols = companySymbolsForCompanyIdMap.get(executionCurrency.getCompanyId());
|
||||
if (cSymbols != null && !cSymbols.isEmpty()) {
|
||||
CompanySymbols companySymbols = cSymbols.iterator().next();
|
||||
executionCurrency.setSellerCode(companySymbols.getCompanySymbolValue());
|
||||
}
|
||||
}
|
||||
{
|
||||
List<CompanySymbols> cSymbols = companySymbolsForCounterPartyIdMap.get(executionCurrency.getCounterPartyId());
|
||||
if (cSymbols != null && !cSymbols.isEmpty()) {
|
||||
CompanySymbols companySymbols = cSymbols.iterator().next();
|
||||
executionCurrency.setBuyerCode(companySymbols.getCompanySymbolValue());
|
||||
}
|
||||
}
|
||||
|
||||
executionCurrency.setBuyerTkrCode(getTCRCodeFromValueOrById(
|
||||
executionCurrency.getCounterPartyTradingClearingRegistry(), // В execution Currency они заполнены
|
||||
executionCurrency.getCounterPartyTradingClearingRegistryId(),
|
||||
tradingClearingRegistryById
|
||||
));
|
||||
executionCurrency.setSellerTkrCode(getTCRCodeFromValueOrById(
|
||||
executionCurrency.getPartyTradingClearingRegistry(), // В execution Currency они заполнены
|
||||
executionCurrency.getTradingClearingRegistryId(),
|
||||
tradingClearingRegistryById
|
||||
));
|
||||
} else if (MoneyFlowSide.BUY.equalsByKey(side) || Side.BUY.equalsByKey(side)) {
|
||||
if (companyByCompanyId != null) {
|
||||
executionCurrency.setBuyer(companyByCompanyId.getShortName());
|
||||
}
|
||||
if (companyByCounterPartyId != null) {
|
||||
executionCurrency.setSeller(companyByCounterPartyId.getShortName());
|
||||
}
|
||||
{
|
||||
List<CompanySymbols> cSymbols = companySymbolsForCompanyIdMap.get(executionCurrency.getCompanyId());
|
||||
if (cSymbols != null && !cSymbols.isEmpty()) {
|
||||
CompanySymbols companySymbols = cSymbols.iterator().next();
|
||||
executionCurrency.setBuyerCode(companySymbols.getCompanySymbolValue());
|
||||
}
|
||||
}
|
||||
{
|
||||
List<CompanySymbols> cSymbols = companySymbolsForCounterPartyIdMap.get(executionCurrency.getCounterPartyId());
|
||||
if (cSymbols != null && !cSymbols.isEmpty()) {
|
||||
CompanySymbols companySymbols = cSymbols.iterator().next();
|
||||
executionCurrency.setSellerCode(companySymbols.getCompanySymbolValue());
|
||||
}
|
||||
}
|
||||
executionCurrency.setBuyerTkrCode(getTCRCodeFromValueOrById(
|
||||
executionCurrency.getPartyTradingClearingRegistry(), // В execution Currency они заполнены
|
||||
executionCurrency.getTradingClearingRegistryId(),
|
||||
tradingClearingRegistryById
|
||||
));
|
||||
executionCurrency.setSellerTkrCode(getTCRCodeFromValueOrById(
|
||||
executionCurrency.getCounterPartyTradingClearingRegistry(), // В execution Currency они заполнены
|
||||
executionCurrency.getCounterPartyTradingClearingRegistryId(),
|
||||
tradingClearingRegistryById
|
||||
));
|
||||
} else {
|
||||
log.warn("Unknown executionCurrency[{}].side={}", executionCurrency.getId(), executionCurrency.getSide());
|
||||
}
|
||||
List<AllowedDictionary> allowed = allowedDictionariesByCode.get(executionCurrency.getCoverageStatus());
|
||||
if (allowed != null && !allowed.isEmpty()) {
|
||||
executionCurrency.setStatus(allowed.iterator().next().getName());
|
||||
}
|
||||
}
|
||||
|
||||
return executionCurrencys;
|
||||
} catch (Exception e) {
|
||||
log.error("Can not load ExecutionCurrency: ", e);
|
||||
throw new RuntimeException("At ExecutionCurrency", e);
|
||||
}
|
||||
}
|
||||
|
||||
String getTCRCodeFromValueOrById(@Nullable String tcrCode, @Nullable Long tcrId, Map<Long, TradingClearingRegistry> tradingClearingRegistryById) {
|
||||
if (tcrCode != null)
|
||||
return tcrCode;
|
||||
if (tcrId != null) {
|
||||
TradingClearingRegistry tcr = tradingClearingRegistryById.get(tcrId);
|
||||
if (tcr == null) {
|
||||
log.warn("Can not find TCR.id={}", tcrId);
|
||||
} else {
|
||||
return tcr.getCode();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExecutionCurrency fromRS(ResultSet resultSet) throws SQLException {
|
||||
ExecutionCurrency object = new ExecutionCurrency();
|
||||
object.setId(resultSet.getObject("ID", Long.class));
|
||||
object.setCreated(getInstantFromTimestamp(resultSet, "CREATED_AT"));
|
||||
object.setUpdated(getInstantFromTimestamp(resultSet, "UPDATED_AT"));
|
||||
object.setExchangeExecutionId(resultSet.getObject("EXCHANGE_EXECUTION_ID", Long.class));
|
||||
object.setExchangeExecutionTime(getInstantFromTimestamp(resultSet, "EXCHANGE_EXECUTION_TIME"));
|
||||
object.setExchangeExecutionMicroseconds(getInstantFromTimestamp(resultSet, "EXCHANGE_EXECUTION_MICROSECONDS"));
|
||||
object.setTradingDate(getLocalDateFromSqlDate(resultSet, "TRADING_DATE"));
|
||||
object.setSettlementDate(getLocalDateFromSqlDate(resultSet, "SETTLEMENT_DATE"));
|
||||
object.setSettlementCode(resultSet.getObject("SETTLEMENT_CODE", String.class));
|
||||
object.setSecurityId(resultSet.getObject("SECURITY_ID", Long.class));
|
||||
object.setSecuritySymbol(resultSet.getObject("SECURITY_SYMBOL", String.class));
|
||||
object.setSecurityFullName(resultSet.getObject("SECURITY_NAME", String.class));
|
||||
object.setCompanyId(resultSet.getObject("COMPANY_ID", Long.class));
|
||||
object.setTradingClearingRegistryId(resultSet.getObject("PARTY_TRADING_CLEARING_REGISTRY_ID", Long.class));
|
||||
object.setPartyTradingClearingRegistry(resultSet.getObject("PARTY_TRADING_CLEARING_REGISTRY", String.class));
|
||||
object.setCounterPartyId(resultSet.getObject("COUNTER_PARTY_ID", Long.class));
|
||||
object.setCounterPartyTradingClearingRegistryId(resultSet.getObject("COUNTER_PARTY_TRADING_CLEARING_REGISTRY_ID", Long.class));
|
||||
object.setCounterPartyTradingClearingRegistry(resultSet.getObject("COUNTER_PARTY_TRADING_CLEARING_REGISTRY", String.class));
|
||||
object.setMarket(resultSet.getObject("MARKET", String.class));
|
||||
object.setPrice(resultSet.getObject("PRICE", BigDecimal.class));
|
||||
object.setLots(resultSet.getObject("LOTS", BigDecimal.class));
|
||||
object.setSettlementAmount(resultSet.getObject("SETTLEMENT_AMOUNT", BigDecimal.class));
|
||||
object.setQuantity(resultSet.getObject("QUANTITY", BigDecimal.class));
|
||||
object.setSide(resultSet.getObject("SIDE", String.class));
|
||||
// object.setCurrencyCode(resultSet.getObject("CURRENCY_CODE", String.class));
|
||||
// object.setSettlementOrganization(resultSet.getObject("SETTLEMENT_ORGANIZATION", String.class));
|
||||
object.setCoverageStatus(resultSet.getObject("COVERAGE_STATUS", String.class));
|
||||
object.setSessionId(resultSet.getObject("SESSION_ID", Long.class));
|
||||
object.setClearingDate(getLocalDateFromSqlDate(resultSet, "CLEARING_DATE"));
|
||||
return object;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -56,15 +56,16 @@ public class ExecutionDepositLoader extends IDBLoader<ExecutionDeposit> {
|
|||
.map(ExecutionDeposit::getCounterPartyTradingClearingRegistryId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet()));
|
||||
|
||||
MapSqlParameterSource parameterSource = new MapSqlParameterSource();
|
||||
parameterSource.addValue("ids", tkrIds);
|
||||
List<TradingClearingRegistry> tradingClearingRegistries = clearingJdbc.query(
|
||||
"select ID, CODE from TRADING_CLEARING_REGISTRY where ID in (:ids)",
|
||||
parameterSource, new TradingClearingRegistryRowMapper()
|
||||
);
|
||||
for (TradingClearingRegistry tkr : tradingClearingRegistries) {
|
||||
tradingClearingRegistryById.put(tkr.getId(), tkr);
|
||||
if (!tkrIds.isEmpty()) {
|
||||
MapSqlParameterSource parameterSource = new MapSqlParameterSource();
|
||||
parameterSource.addValue("ids", tkrIds);
|
||||
List<TradingClearingRegistry> tradingClearingRegistries = clearingJdbc.query(
|
||||
"select ID, CODE from TRADING_CLEARING_REGISTRY where ID in (:ids)",
|
||||
parameterSource, new TradingClearingRegistryRowMapper()
|
||||
);
|
||||
for (TradingClearingRegistry tkr : tradingClearingRegistries) {
|
||||
tradingClearingRegistryById.put(tkr.getId(), tkr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,15 +47,16 @@ public class ExecutionFondLoader extends IDBLoader<ExecutionFond> {
|
|||
.map(ExecutionFond::getCounterPartyTradingClearingRegistryId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet()));
|
||||
|
||||
MapSqlParameterSource parameterSource = new MapSqlParameterSource();
|
||||
parameterSource.addValue("ids", tkrIds);
|
||||
List<TradingClearingRegistry> tradingClearingRegistries = clearingJdbc.query(
|
||||
"select ID, CODE from TRADING_CLEARING_REGISTRY where ID in (:ids)",
|
||||
parameterSource, new TradingClearingRegistryRowMapper()
|
||||
);
|
||||
for (TradingClearingRegistry tkr : tradingClearingRegistries) {
|
||||
tradingClearingRegistryById.put(tkr.getId(), tkr);
|
||||
if (!tkrIds.isEmpty()) {
|
||||
MapSqlParameterSource parameterSource = new MapSqlParameterSource();
|
||||
parameterSource.addValue("ids", tkrIds);
|
||||
List<TradingClearingRegistry> tradingClearingRegistries = clearingJdbc.query(
|
||||
"select ID, CODE from TRADING_CLEARING_REGISTRY where ID in (:ids)",
|
||||
parameterSource, new TradingClearingRegistryRowMapper()
|
||||
);
|
||||
for (TradingClearingRegistry tkr : tradingClearingRegistries) {
|
||||
tradingClearingRegistryById.put(tkr.getId(), tkr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ public class LiabilitiesRegistryReport implements FileReport {
|
|||
@BindByPosition(position = 9)
|
||||
private String session_type;
|
||||
|
||||
@BindByName(column = "номер сделки")
|
||||
@BindByPosition(position = 10)
|
||||
private String executionNumber;
|
||||
|
||||
public String getShort_name() {
|
||||
return short_name;
|
||||
}
|
||||
|
|
@ -130,4 +134,12 @@ public class LiabilitiesRegistryReport implements FileReport {
|
|||
public void setSession_type(String session_type) {
|
||||
this.session_type = session_type;
|
||||
}
|
||||
|
||||
public String getExecutionNumber() {
|
||||
return executionNumber;
|
||||
}
|
||||
|
||||
public void setExecutionNumber(String executionNumber) {
|
||||
this.executionNumber = executionNumber;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ public class RegisterUtilityRunner {
|
|||
private final MoneyBalanceLoader moneyBalanceLoader;
|
||||
private final ExecutionDepositLoader executionDepositLoader;
|
||||
private final ExecutionFondLoader executionFondLoader;
|
||||
private final ExecutionCurrencyLoader executionCurrencyLoader;
|
||||
private final RegistryLoader registryLoader;
|
||||
|
||||
private final DepoPaymentInstructionBuilder depoPaymentInstructionBuilder;
|
||||
|
|
@ -40,6 +41,7 @@ public class RegisterUtilityRunner {
|
|||
MoneyBalanceLoader moneyBalanceLoader,
|
||||
ExecutionDepositLoader executionDepositLoader,
|
||||
ExecutionFondLoader executionFondLoader,
|
||||
ExecutionCurrencyLoader executionCurrencyLoader,
|
||||
RegistryLoader registryLoader,
|
||||
DepoPaymentInstructionBuilder depoPaymentInstructionBuilder,
|
||||
DepoBalanceRegisterReportBuilder depoBalanceRegisterReportBuilder,
|
||||
|
|
@ -54,6 +56,7 @@ public class RegisterUtilityRunner {
|
|||
this.moneyBalanceLoader = moneyBalanceLoader;
|
||||
this.executionDepositLoader = executionDepositLoader;
|
||||
this.executionFondLoader = executionFondLoader;
|
||||
this.executionCurrencyLoader = executionCurrencyLoader;
|
||||
this.registryLoader = registryLoader;
|
||||
this.depoPaymentInstructionBuilder = depoPaymentInstructionBuilder;
|
||||
this.depoBalanceRegisterReportBuilder = depoBalanceRegisterReportBuilder;
|
||||
|
|
@ -68,6 +71,7 @@ public class RegisterUtilityRunner {
|
|||
public void process() throws InterruptedException {
|
||||
List<ExecutionDeposit> executionDeposits = new ArrayList<>();
|
||||
List<ExecutionFond> executionFonds = new ArrayList<>();
|
||||
List<ExecutionCurrency> executionCurrencys = new ArrayList<>();
|
||||
List<PaymentInstruction> moneyPaymentInstruction = new ArrayList<>();
|
||||
List<PaymentInstruction> depoPaymentInstruction = new ArrayList<>();
|
||||
List<RegistryHistory> moneyBalances = new ArrayList<>();
|
||||
|
|
@ -79,6 +83,7 @@ public class RegisterUtilityRunner {
|
|||
try {
|
||||
catchExceptions.add(executorService.submit(() -> executionDeposits.addAll(executionDepositLoader.loadObjects())));
|
||||
catchExceptions.add(executorService.submit(() -> executionFonds.addAll(executionFondLoader.loadObjects())));
|
||||
catchExceptions.add(executorService.submit(() -> executionCurrencys.addAll(executionCurrencyLoader.loadObjects())));
|
||||
catchExceptions.add(executorService.submit(() -> depoPaymentInstruction.addAll(depoInstructionLoader.loadObjects())));
|
||||
catchExceptions.add(executorService.submit(() -> moneyPaymentInstruction.addAll(moneyInstructionLoader.loadObjects())));
|
||||
catchExceptions.add(executorService.submit(() -> moneyBalances.addAll(moneyBalanceLoader.loadObjects())));
|
||||
|
|
@ -111,6 +116,7 @@ public class RegisterUtilityRunner {
|
|||
Set<ExecutionCommon> executionCommons = new HashSet<>();
|
||||
executionCommons.addAll(executionDeposits);
|
||||
executionCommons.addAll(executionFonds);
|
||||
executionCommons.addAll(executionCurrencys);
|
||||
executionRegisterReportBuilder.buildReport(executionCommons, outFolder);
|
||||
log.info("Все отчёты завершены.");
|
||||
// todo возможно понадобится отсылать на SFTP ReportUtils.sendFilesToSftp
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue