http://jira.mfd.msk:8088/browse/CLS-985 OrderCurrency history subscription
This commit is contained in:
parent
8a26b55d34
commit
206dd19aca
5 changed files with 110 additions and 0 deletions
|
|
@ -45,6 +45,7 @@ public class HistoryConfig {
|
|||
hst.add(liabilitiesRegister());
|
||||
hst.add(executionRegister());
|
||||
hst.add(session());
|
||||
hst.add(orderCurrency());
|
||||
return hst;
|
||||
}
|
||||
|
||||
|
|
@ -192,4 +193,16 @@ public class HistoryConfig {
|
|||
));
|
||||
return sbscr;
|
||||
}
|
||||
|
||||
private HistorySubscription orderCurrency() {
|
||||
HistorySubscription sbscr = new HistorySubscription();
|
||||
sbscr.setDestination("order-currency");
|
||||
sbscr.setSearchProxyMapName(IMDGDistributedNames.Map_SearchOrderCurrency);
|
||||
sbscr.setFullHistoryMapName(IMDGDistributedNames.Map_OrderCurrency);
|
||||
sbscr.setConditions(List.of(
|
||||
new CreatedFromCondition(pb),
|
||||
new CreatedToCondition(pb)
|
||||
));
|
||||
return sbscr;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package ru.spcex.clearing.historyimdg.index;
|
||||
|
||||
import java.time.Instant;
|
||||
import ru.spcex.clearing.historyimdg.index.field.SearchWithCreated;
|
||||
|
||||
public class SearchProxyOrderCurrency extends SearchProxy implements SearchWithCreated {
|
||||
private Instant created;
|
||||
|
||||
@Override
|
||||
public Instant getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCreated(Instant created) {
|
||||
this.created = created;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package ru.spcex.clearing.historyimdg.mapstores;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.clearing.classes.statics.data.misc.OrderCurrency;
|
||||
import ru.spcex.clearing.imdg.businessobject.OrderCurrencyMapStore;
|
||||
|
||||
@Component
|
||||
public class OrderCurrencyHistoryMapStore extends OrderCurrencyMapStore {
|
||||
public OrderCurrencyHistoryMapStore(JdbcTemplate jdbcTemplate) {
|
||||
super(jdbcTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isLoadable(Long id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isLoadable(OrderCurrency obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Long> loadAllKeys() {
|
||||
log.debug("OrderCurrency loadAllKeys is called");
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package ru.spcex.clearing.historyimdg.mapstores;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.historyimdg.index.SearchProxyOrderCurrency;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
|
||||
@Component
|
||||
public class SearchOrderCurrencyMapStore extends AbstractSliceMapLoader<SearchProxyOrderCurrency> {
|
||||
public SearchOrderCurrencyMapStore(JdbcTemplate jdbcTemplate) {
|
||||
super(jdbcTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTableName() {
|
||||
return "order_currency";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String fieldOfDay() {
|
||||
return "CREATED_AT";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<SearchProxyOrderCurrency> load(Collection<Long> keys) {
|
||||
Map<String, Collection<Long>> paramMap = Collections.singletonMap("ids", keys);
|
||||
return namedParameterJdbcTemplate.query("select * from " + getTableName() + " where id in (:ids)", paramMap,
|
||||
(rs, rowNum) -> {
|
||||
SearchProxyOrderCurrency proxyOrder = new SearchProxyOrderCurrency();
|
||||
proxyOrder.setId(rs.getObject("id", Long.class));
|
||||
proxyOrder.setCreated(getInstantFromTimestamp(rs, "CREATED_AT"));
|
||||
return proxyOrder;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMapName() {
|
||||
return IMDGDistributedNames.Map_SearchOrderCurrency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getIndexingField() {
|
||||
return new String[]{"created"};
|
||||
}
|
||||
}
|
||||
|
|
@ -250,6 +250,7 @@ public final class IMDGDistributedNames {
|
|||
public static final String Map_SearchExecutionRegister = "Map_SearchExecutionRegister";
|
||||
public static final String Map_SearchSession = "Map_SearchSession";
|
||||
public static final String Map_SearchSessionHistory = "Map_SearchSessionHistory";
|
||||
public static final String Map_SearchOrderCurrency = "Map_SearchOrderCurrency";
|
||||
public static final String MAP_SEQUENCE_NAME = "MAP_SEQUENCE_NAME";
|
||||
|
||||
private IMDGDistributedNames() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue