registry-service http://jira.mfd.msk:8088/browse/CLS-680 добавил ExecutionCurrency, правки поле

This commit is contained in:
AKurakin 2024-06-06 18:28:43 +03:00
parent b6f371dfc9
commit 2289d1ed6c
9 changed files with 396 additions and 20 deletions

View file

@ -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;
}
}

View file

@ -1,5 +1,5 @@
package ru.spcex.clearing.registry.reports.bean; package ru.spcex.clearing.registry.reports.bean;
public enum ExecutionType { public enum ExecutionType {
ExecutionDeposit, ExecutionFond; ExecutionDeposit, ExecutionFond, ExecutionCurrency;
} }

View file

@ -2,6 +2,7 @@ package ru.spcex.clearing.registry.reports.builders;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.spcex.clearing.registry.reports.bean.ExecutionCommon; 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.ExecutionDeposit;
import ru.spcex.clearing.registry.reports.bean.ExecutionFond; import ru.spcex.clearing.registry.reports.bean.ExecutionFond;
import ru.spcex.clearing.registry.reports.report.ExecutionRegisterReport; 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()); if (fond.getInterestAmount() != null) sum = sum.add(fond.getInterestAmount());
entity.setAmount(sum); entity.setAmount(sum);
entity.setQuantity(fond.getQuantity()); 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.setStatus(input.getStatus());
entity.setMarket(input.getMarket()); entity.setMarket(input.getMarket());

View file

@ -3,6 +3,7 @@ package ru.spcex.clearing.registry.reports.builders;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.spcex.clearing.registry.reports.bean.Registry; import ru.spcex.clearing.registry.reports.bean.Registry;
import ru.spcex.clearing.registry.reports.report.LiabilitiesRegistryReport; import ru.spcex.clearing.registry.reports.report.LiabilitiesRegistryReport;
import ru.spcex.platform.enumeration.SessionType;
import java.util.Collection; import java.util.Collection;
import java.util.Comparator; import java.util.Comparator;
@ -34,8 +35,13 @@ public class LiabilitiesRegistryReportBuilder extends XLSXReportBuilder<Liabilit
entity.setSecurity_symbol(input.getSecuritySymbol()); entity.setSecurity_symbol(input.getSecuritySymbol());
entity.setBalance(input.getBalance()); entity.setBalance(input.getBalance());
entity.setSettlement_date(input.getSettlementDate()); entity.setSettlement_date(input.getSettlementDate());
if (!SessionType.CURR.equalsByKey(input.getSessionType())) {
entity.setContract(input.getContract()); entity.setContract(input.getContract());
}
entity.setSession_type(input.getSessionType_dictionary()); entity.setSession_type(input.getSessionType_dictionary());
if (input.getGroupId() != null) {
entity.setExecutionNumber(String.valueOf(input.getGroupId()));
}
return entity; return entity;
} }

View file

@ -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;
}
}

View file

@ -56,7 +56,7 @@ public class ExecutionDepositLoader extends IDBLoader<ExecutionDeposit> {
.map(ExecutionDeposit::getCounterPartyTradingClearingRegistryId) .map(ExecutionDeposit::getCounterPartyTradingClearingRegistryId)
.filter(Objects::nonNull) .filter(Objects::nonNull)
.collect(Collectors.toSet())); .collect(Collectors.toSet()));
if (!tkrIds.isEmpty()) {
MapSqlParameterSource parameterSource = new MapSqlParameterSource(); MapSqlParameterSource parameterSource = new MapSqlParameterSource();
parameterSource.addValue("ids", tkrIds); parameterSource.addValue("ids", tkrIds);
List<TradingClearingRegistry> tradingClearingRegistries = clearingJdbc.query( List<TradingClearingRegistry> tradingClearingRegistries = clearingJdbc.query(
@ -67,6 +67,7 @@ public class ExecutionDepositLoader extends IDBLoader<ExecutionDeposit> {
tradingClearingRegistryById.put(tkr.getId(), tkr); tradingClearingRegistryById.put(tkr.getId(), tkr);
} }
} }
}
Map<Long, List<CompanySymbols>> companySymbolsForCompanyIdMap; Map<Long, List<CompanySymbols>> companySymbolsForCompanyIdMap;
{ {

View file

@ -47,7 +47,7 @@ public class ExecutionFondLoader extends IDBLoader<ExecutionFond> {
.map(ExecutionFond::getCounterPartyTradingClearingRegistryId) .map(ExecutionFond::getCounterPartyTradingClearingRegistryId)
.filter(Objects::nonNull) .filter(Objects::nonNull)
.collect(Collectors.toSet())); .collect(Collectors.toSet()));
if (!tkrIds.isEmpty()) {
MapSqlParameterSource parameterSource = new MapSqlParameterSource(); MapSqlParameterSource parameterSource = new MapSqlParameterSource();
parameterSource.addValue("ids", tkrIds); parameterSource.addValue("ids", tkrIds);
List<TradingClearingRegistry> tradingClearingRegistries = clearingJdbc.query( List<TradingClearingRegistry> tradingClearingRegistries = clearingJdbc.query(
@ -58,6 +58,7 @@ public class ExecutionFondLoader extends IDBLoader<ExecutionFond> {
tradingClearingRegistryById.put(tkr.getId(), tkr); tradingClearingRegistryById.put(tkr.getId(), tkr);
} }
} }
}
Map<Long, List<CompanySymbols>> companySymbolsForCompanyIdMap; Map<Long, List<CompanySymbols>> companySymbolsForCompanyIdMap;
{ {

View file

@ -51,6 +51,10 @@ public class LiabilitiesRegistryReport implements FileReport {
@BindByPosition(position = 9) @BindByPosition(position = 9)
private String session_type; private String session_type;
@BindByName(column = "номер сделки")
@BindByPosition(position = 10)
private String executionNumber;
public String getShort_name() { public String getShort_name() {
return short_name; return short_name;
} }
@ -130,4 +134,12 @@ public class LiabilitiesRegistryReport implements FileReport {
public void setSession_type(String session_type) { public void setSession_type(String session_type) {
this.session_type = session_type; this.session_type = session_type;
} }
public String getExecutionNumber() {
return executionNumber;
}
public void setExecutionNumber(String executionNumber) {
this.executionNumber = executionNumber;
}
} }

View file

@ -23,6 +23,7 @@ public class RegisterUtilityRunner {
private final MoneyBalanceLoader moneyBalanceLoader; private final MoneyBalanceLoader moneyBalanceLoader;
private final ExecutionDepositLoader executionDepositLoader; private final ExecutionDepositLoader executionDepositLoader;
private final ExecutionFondLoader executionFondLoader; private final ExecutionFondLoader executionFondLoader;
private final ExecutionCurrencyLoader executionCurrencyLoader;
private final RegistryLoader registryLoader; private final RegistryLoader registryLoader;
private final DepoPaymentInstructionBuilder depoPaymentInstructionBuilder; private final DepoPaymentInstructionBuilder depoPaymentInstructionBuilder;
@ -40,6 +41,7 @@ public class RegisterUtilityRunner {
MoneyBalanceLoader moneyBalanceLoader, MoneyBalanceLoader moneyBalanceLoader,
ExecutionDepositLoader executionDepositLoader, ExecutionDepositLoader executionDepositLoader,
ExecutionFondLoader executionFondLoader, ExecutionFondLoader executionFondLoader,
ExecutionCurrencyLoader executionCurrencyLoader,
RegistryLoader registryLoader, RegistryLoader registryLoader,
DepoPaymentInstructionBuilder depoPaymentInstructionBuilder, DepoPaymentInstructionBuilder depoPaymentInstructionBuilder,
DepoBalanceRegisterReportBuilder depoBalanceRegisterReportBuilder, DepoBalanceRegisterReportBuilder depoBalanceRegisterReportBuilder,
@ -54,6 +56,7 @@ public class RegisterUtilityRunner {
this.moneyBalanceLoader = moneyBalanceLoader; this.moneyBalanceLoader = moneyBalanceLoader;
this.executionDepositLoader = executionDepositLoader; this.executionDepositLoader = executionDepositLoader;
this.executionFondLoader = executionFondLoader; this.executionFondLoader = executionFondLoader;
this.executionCurrencyLoader = executionCurrencyLoader;
this.registryLoader = registryLoader; this.registryLoader = registryLoader;
this.depoPaymentInstructionBuilder = depoPaymentInstructionBuilder; this.depoPaymentInstructionBuilder = depoPaymentInstructionBuilder;
this.depoBalanceRegisterReportBuilder = depoBalanceRegisterReportBuilder; this.depoBalanceRegisterReportBuilder = depoBalanceRegisterReportBuilder;
@ -68,6 +71,7 @@ public class RegisterUtilityRunner {
public void process() throws InterruptedException { public void process() throws InterruptedException {
List<ExecutionDeposit> executionDeposits = new ArrayList<>(); List<ExecutionDeposit> executionDeposits = new ArrayList<>();
List<ExecutionFond> executionFonds = new ArrayList<>(); List<ExecutionFond> executionFonds = new ArrayList<>();
List<ExecutionCurrency> executionCurrencys = new ArrayList<>();
List<PaymentInstruction> moneyPaymentInstruction = new ArrayList<>(); List<PaymentInstruction> moneyPaymentInstruction = new ArrayList<>();
List<PaymentInstruction> depoPaymentInstruction = new ArrayList<>(); List<PaymentInstruction> depoPaymentInstruction = new ArrayList<>();
List<RegistryHistory> moneyBalances = new ArrayList<>(); List<RegistryHistory> moneyBalances = new ArrayList<>();
@ -79,6 +83,7 @@ public class RegisterUtilityRunner {
try { try {
catchExceptions.add(executorService.submit(() -> executionDeposits.addAll(executionDepositLoader.loadObjects()))); catchExceptions.add(executorService.submit(() -> executionDeposits.addAll(executionDepositLoader.loadObjects())));
catchExceptions.add(executorService.submit(() -> executionFonds.addAll(executionFondLoader.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(() -> depoPaymentInstruction.addAll(depoInstructionLoader.loadObjects())));
catchExceptions.add(executorService.submit(() -> moneyPaymentInstruction.addAll(moneyInstructionLoader.loadObjects()))); catchExceptions.add(executorService.submit(() -> moneyPaymentInstruction.addAll(moneyInstructionLoader.loadObjects())));
catchExceptions.add(executorService.submit(() -> moneyBalances.addAll(moneyBalanceLoader.loadObjects()))); catchExceptions.add(executorService.submit(() -> moneyBalances.addAll(moneyBalanceLoader.loadObjects())));
@ -111,6 +116,7 @@ public class RegisterUtilityRunner {
Set<ExecutionCommon> executionCommons = new HashSet<>(); Set<ExecutionCommon> executionCommons = new HashSet<>();
executionCommons.addAll(executionDeposits); executionCommons.addAll(executionDeposits);
executionCommons.addAll(executionFonds); executionCommons.addAll(executionFonds);
executionCommons.addAll(executionCurrencys);
executionRegisterReportBuilder.buildReport(executionCommons, outFolder); executionRegisterReportBuilder.buildReport(executionCommons, outFolder);
log.info("Все отчёты завершены."); log.info("Все отчёты завершены.");
// todo возможно понадобится отсылать на SFTP ReportUtils.sendFilesToSftp // todo возможно понадобится отсылать на SFTP ReportUtils.sendFilesToSftp