backend-api imdg-hist http://jira.mfd.msk:8088/browse/CLS-523 session-history
This commit is contained in:
parent
f6ffca32b4
commit
5ca2153a3b
10 changed files with 113 additions and 4 deletions
|
|
@ -40,6 +40,7 @@ public class HistoryConfig {
|
|||
hst.add(excludeLiabilitiesRegister());
|
||||
hst.add(liabilitiesRegister());
|
||||
hst.add(executionRegister());
|
||||
hst.add(session());
|
||||
return hst;
|
||||
}
|
||||
|
||||
|
|
@ -174,4 +175,17 @@ public class HistoryConfig {
|
|||
));
|
||||
return sbscr;
|
||||
}
|
||||
|
||||
|
||||
private HistorySubscription session() {
|
||||
HistorySubscription sbscr = new HistorySubscription();
|
||||
sbscr.setDestination("session");
|
||||
sbscr.setSearchProxyMapName(IMDGDistributedNames.Map_SearchSession);
|
||||
sbscr.setFullHistoryMapName(IMDGDistributedNames.Map_Session);
|
||||
sbscr.setConditions(List.of(
|
||||
new TradingDateFromCondition(pb),
|
||||
new TradingDateToCondition(pb)
|
||||
));
|
||||
return sbscr;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
{
|
||||
"version": "3.11.0.84",
|
||||
"version": "3.11.0.85",
|
||||
|
||||
"enums": {
|
||||
|
||||
|
|
@ -6140,6 +6140,8 @@
|
|||
|
||||
"destination": "sessions",
|
||||
|
||||
"historyDestination": "history",
|
||||
|
||||
"class": "ru.clearing.classes.statics.data.misc.Session",
|
||||
|
||||
"logUpdates": "true",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--?xml-stylesheet type="text/xsl" href="\..\corp-reports\src\data\meta\meta.server.xslt"?-->
|
||||
<meta version="3.11.0.84">
|
||||
<meta version="3.11.0.85">
|
||||
<!-- _xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" _xsi:noNamespaceSchemaLocation="file:///E:/d/projects/meta/from/meta.xsd" -->
|
||||
<!--Здесь словари-->
|
||||
<enums>
|
||||
|
|
@ -1414,7 +1414,7 @@
|
|||
</post>
|
||||
</actions>
|
||||
</launcher>
|
||||
<session name="Клиринговые сессии" destination="sessions" class="ru.clearing.classes.statics.data.misc.Session" logUpdates="true" table="session">
|
||||
<session name="Клиринговые сессии" destination="sessions" historyDestination="history" class="ru.clearing.classes.statics.data.misc.Session" logUpdates="true" table="session">
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
||||
<createdAt field="created" type="4" webtype="5" dbname="Дата-время создания записи" name="Время создания записи" shortname="Создано" searchable="true" sortable="true"/>
|
||||
<updatedAt field="updated" type="4" webtype="5" dbname="Дата-время изменения записи" name="Время изменения записи" shortname="Завершено" searchable="true" sortable="true"/>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
{
|
||||
"version": "3.11.0.83",
|
||||
"version": "3.11.0.85",
|
||||
|
||||
"enums": {
|
||||
|
||||
|
|
@ -4764,6 +4764,10 @@
|
|||
{"code": "accountType",
|
||||
"type": 12,"name": "Наименование типа счета","shortname": "Тип","link": "accountType","required": true,"visible": false
|
||||
}
|
||||
,
|
||||
{"code": "currency",
|
||||
"type": 12,"name": "Код валюты","shortname": "Валюта","visible": true,"link": "currencyCode","linkCode": "code"
|
||||
}
|
||||
]
|
||||
}
|
||||
,
|
||||
|
|
@ -6136,6 +6140,8 @@
|
|||
|
||||
"destination": "sessions",
|
||||
|
||||
"historyDestination": "history",
|
||||
|
||||
"class": "ru.clearing.classes.statics.data.misc.Session",
|
||||
|
||||
"logUpdates": "true",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package ru.spcex.clearing.historyimdg.index;
|
||||
|
||||
import ru.spcex.clearing.historyimdg.index.field.SearchWithTradingDate;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class SearchProxySession extends SearchProxy implements SearchWithTradingDate {
|
||||
/**
|
||||
* trading_date или created_at
|
||||
*/
|
||||
private LocalDate tradingDate;
|
||||
|
||||
@Override
|
||||
public LocalDate getTradingDate() {
|
||||
return tradingDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTradingDate(LocalDate tradingDate) {
|
||||
this.tradingDate = tradingDate;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
package ru.spcex.clearing.historyimdg.mapstores;
|
||||
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.spcex.clearing.historyimdg.index.SearchProxySession;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class SearchSessionMapStore extends AbstractSliceMapLoader<SearchProxySession> {
|
||||
public SearchSessionMapStore(JdbcTemplate jdbcTemplate) {
|
||||
super(jdbcTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTableName() {
|
||||
return "session";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String fieldOfDay() {
|
||||
return "clearing_date"; // or "created_at" ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<SearchProxySession> 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) -> {
|
||||
SearchProxySession proxyFond = new SearchProxySession();
|
||||
proxyFond.setId(rs.getObject("id", Long.class));
|
||||
LocalDate date = getLocalDateFromSqlDate(rs, "trading_date");
|
||||
if (date == null)
|
||||
date = getLocalDateFromSqlDate(rs, "created_at");
|
||||
proxyFond.setTradingDate(date);
|
||||
return proxyFond;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMapName() {
|
||||
return IMDGDistributedNames.Map_SearchSession;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getIndexingField() {
|
||||
return new String[]{"clearingDate"};
|
||||
}
|
||||
}
|
||||
|
|
@ -45,6 +45,11 @@ public class ImdgPredicateBuilderHazelcast implements ImdgPredicateBuilder {
|
|||
return new ImdgPredicateHazelcast(Predicates.not(Predicates.equal(key, null)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImdgPredicate isNull(String key) {
|
||||
return new ImdgPredicateHazelcast(Predicates.equal(key, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImdgPredicate in(String key, Comparable[] values) {
|
||||
return new ImdgPredicateHazelcast(Predicates.in(key, values));
|
||||
|
|
|
|||
|
|
@ -223,6 +223,7 @@ public final class IMDGDistributedNames {
|
|||
public static final String Map_SearchExcludeLiabilitiesRegister = "Map_SearchExcludeLiabilitiesRegister";
|
||||
public static final String Map_SearchLiabilitiesRegister = "Map_SearchLiabilitiesRegister";
|
||||
public static final String Map_SearchExecutionRegister = "Map_SearchExecutionRegister";
|
||||
public static final String Map_SearchSession = "Map_SearchSession";
|
||||
public static final String MAP_SEQUENCE_NAME = "MAP_SEQUENCE_NAME";
|
||||
|
||||
private IMDGDistributedNames() {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ public interface ImdgPredicateBuilder {
|
|||
ImdgPredicate greater(String key, Comparable value);
|
||||
ImdgPredicate less(String key, Comparable value);
|
||||
ImdgPredicate notNull(String key);
|
||||
ImdgPredicate isNull(String key);
|
||||
|
||||
ImdgPredicate in(String key, Comparable... values);
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,11 @@ public class ImdgPredicateBuilderSqlMock implements ImdgPredicateBuilder {
|
|||
return new SimpleSQLPredicate(key + " is not null");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImdgPredicate isNull(String key) {
|
||||
return new SimpleSQLPredicate(key + " is null");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImdgPredicate in(String key, Comparable[] values) {
|
||||
String enumiration = Arrays.stream(values).map(this::escape).collect(Collectors.joining(", "));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue