registry-service http://jira.mfd.msk:8088/browse/CLS-788 заполнение ТКР для ЛКЦ
This commit is contained in:
parent
bf63c85837
commit
492e2bef95
1 changed files with 60 additions and 17 deletions
|
|
@ -24,6 +24,8 @@ import static ru.spcex.clearing.registry.reports.ReportUtils.getLocalDateFromSql
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class ExecutionCurrencyLoader extends IDBLoader<ExecutionCurrency> {
|
public class ExecutionCurrencyLoader extends IDBLoader<ExecutionCurrency> {
|
||||||
|
static final Long COMPANY_LKC_ID = 5L;
|
||||||
|
|
||||||
public ExecutionCurrencyLoader(AProperties properties, NamedParameterJdbcTemplate clearingJdbc) {
|
public ExecutionCurrencyLoader(AProperties properties, NamedParameterJdbcTemplate clearingJdbc) {
|
||||||
super(properties.getPeriod(), clearingJdbc);
|
super(properties.getPeriod(), clearingJdbc);
|
||||||
}
|
}
|
||||||
|
|
@ -48,6 +50,7 @@ public class ExecutionCurrencyLoader extends IDBLoader<ExecutionCurrency> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<Long, TradingClearingRegistry> tradingClearingRegistryById = new HashMap<>();
|
Map<Long, TradingClearingRegistry> tradingClearingRegistryById = new HashMap<>();
|
||||||
|
TradingClearingRegistry tcrForCompanyLKC = null;
|
||||||
{
|
{
|
||||||
Set<Long> tkrIds = executionCurrencys.stream()
|
Set<Long> tkrIds = executionCurrencys.stream()
|
||||||
.filter(eDep -> eDep.getPartyTradingClearingRegistry() == null) // оптимизация;
|
.filter(eDep -> eDep.getPartyTradingClearingRegistry() == null) // оптимизация;
|
||||||
|
|
@ -70,6 +73,22 @@ public class ExecutionCurrencyLoader extends IDBLoader<ExecutionCurrency> {
|
||||||
tradingClearingRegistryById.put(tkr.getId(), tkr);
|
tradingClearingRegistryById.put(tkr.getId(), tkr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
MapSqlParameterSource parameterSource = new MapSqlParameterSource();
|
||||||
|
parameterSource.addValue("ids", COMPANY_LKC_ID);
|
||||||
|
List<TradingClearingRegistry> tradingClearingRegistries = clearingJdbc.query(
|
||||||
|
"select ID, CODE from TRADING_CLEARING_REGISTRY where COMPANY_ID = :ids",
|
||||||
|
parameterSource, new TradingClearingRegistryRowMapper()
|
||||||
|
);
|
||||||
|
for (TradingClearingRegistry tcr5 : tradingClearingRegistries) {
|
||||||
|
if (tcrForCompanyLKC != null)
|
||||||
|
log.warn("Has many TCR for company {}: another {}", COMPANY_LKC_ID, tcrForCompanyLKC.getCode());
|
||||||
|
tcrForCompanyLKC = tcr5;
|
||||||
|
}
|
||||||
|
if (tcrForCompanyLKC == null) {
|
||||||
|
log.warn("TCR for companyId={} not found", COMPANY_LKC_ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<Long, List<CompanySymbols>> companySymbolsForCompanyIdMap;
|
Map<Long, List<CompanySymbols>> companySymbolsForCompanyIdMap;
|
||||||
|
|
@ -153,16 +172,28 @@ public class ExecutionCurrencyLoader extends IDBLoader<ExecutionCurrency> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
executionCurrency.setBuyerTkrCode(getTCRCodeFromValueOrById(
|
if (COMPANY_LKC_ID.equals(executionCurrency.getCounterPartyId())) { // 800 ЛЦК 5
|
||||||
|
if (tcrForCompanyLKC != null) {
|
||||||
|
executionCurrency.setBuyerTkrCode(tcrForCompanyLKC.getCode());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
executionCurrency.setBuyerTkrCode(getTCRCodeFromValueOrById(
|
||||||
executionCurrency.getCounterPartyTradingClearingRegistry(), // В execution Currency они заполнены
|
executionCurrency.getCounterPartyTradingClearingRegistry(), // В execution Currency они заполнены
|
||||||
executionCurrency.getCounterPartyTradingClearingRegistryId(),
|
executionCurrency.getCounterPartyTradingClearingRegistryId(),
|
||||||
tradingClearingRegistryById
|
tradingClearingRegistryById
|
||||||
));
|
));
|
||||||
executionCurrency.setSellerTkrCode(getTCRCodeFromValueOrById(
|
}
|
||||||
executionCurrency.getPartyTradingClearingRegistry(), // В execution Currency они заполнены
|
if (COMPANY_LKC_ID.equals(executionCurrency.getCompanyId())) { // 800 ЛЦК 5
|
||||||
executionCurrency.getTradingClearingRegistryId(),
|
if (tcrForCompanyLKC != null) {
|
||||||
tradingClearingRegistryById
|
executionCurrency.setSellerTkrCode(tcrForCompanyLKC.getCode());
|
||||||
));
|
}
|
||||||
|
} else {
|
||||||
|
executionCurrency.setSellerTkrCode(getTCRCodeFromValueOrById(
|
||||||
|
executionCurrency.getPartyTradingClearingRegistry(), // В execution Currency они заполнены
|
||||||
|
executionCurrency.getTradingClearingRegistryId(),
|
||||||
|
tradingClearingRegistryById
|
||||||
|
));
|
||||||
|
}
|
||||||
} else if (MoneyFlowSide.BUY.equalsByKey(side) || Side.BUY.equalsByKey(side)) {
|
} else if (MoneyFlowSide.BUY.equalsByKey(side) || Side.BUY.equalsByKey(side)) {
|
||||||
if (companyByCompanyId != null) {
|
if (companyByCompanyId != null) {
|
||||||
executionCurrency.setBuyer(companyByCompanyId.getShortName());
|
executionCurrency.setBuyer(companyByCompanyId.getShortName());
|
||||||
|
|
@ -184,16 +215,28 @@ public class ExecutionCurrencyLoader extends IDBLoader<ExecutionCurrency> {
|
||||||
executionCurrency.setSellerCode(companySymbols.getCompanySymbolValue());
|
executionCurrency.setSellerCode(companySymbols.getCompanySymbolValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
executionCurrency.setBuyerTkrCode(getTCRCodeFromValueOrById(
|
if (COMPANY_LKC_ID.equals(executionCurrency.getCompanyId())) { // 800 ЛЦК 5
|
||||||
executionCurrency.getPartyTradingClearingRegistry(), // В execution Currency они заполнены
|
if (tcrForCompanyLKC != null) {
|
||||||
executionCurrency.getTradingClearingRegistryId(),
|
executionCurrency.setBuyerTkrCode(tcrForCompanyLKC.getCode());
|
||||||
tradingClearingRegistryById
|
}
|
||||||
));
|
} else {
|
||||||
executionCurrency.setSellerTkrCode(getTCRCodeFromValueOrById(
|
executionCurrency.setBuyerTkrCode(getTCRCodeFromValueOrById(
|
||||||
executionCurrency.getCounterPartyTradingClearingRegistry(), // В execution Currency они заполнены
|
executionCurrency.getPartyTradingClearingRegistry(), // В execution Currency они заполнены
|
||||||
executionCurrency.getCounterPartyTradingClearingRegistryId(),
|
executionCurrency.getTradingClearingRegistryId(),
|
||||||
tradingClearingRegistryById
|
tradingClearingRegistryById
|
||||||
));
|
));
|
||||||
|
}
|
||||||
|
if (COMPANY_LKC_ID.equals(executionCurrency.getCounterPartyId())) { // 800 ЛЦК 5
|
||||||
|
if (tcrForCompanyLKC != null) {
|
||||||
|
executionCurrency.setSellerTkrCode(tcrForCompanyLKC.getCode());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
executionCurrency.setSellerTkrCode(getTCRCodeFromValueOrById(
|
||||||
|
executionCurrency.getCounterPartyTradingClearingRegistry(), // В execution Currency они заполнены
|
||||||
|
executionCurrency.getCounterPartyTradingClearingRegistryId(),
|
||||||
|
tradingClearingRegistryById
|
||||||
|
));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
log.warn("Unknown executionCurrency[{}].side={}", executionCurrency.getId(), executionCurrency.getSide());
|
log.warn("Unknown executionCurrency[{}].side={}", executionCurrency.getId(), executionCurrency.getSide());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue