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(excludeLiabilitiesRegister());
|
||||||
hst.add(liabilitiesRegister());
|
hst.add(liabilitiesRegister());
|
||||||
hst.add(executionRegister());
|
hst.add(executionRegister());
|
||||||
|
hst.add(session());
|
||||||
return hst;
|
return hst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -174,4 +175,17 @@ public class HistoryConfig {
|
||||||
));
|
));
|
||||||
return sbscr;
|
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": {
|
"enums": {
|
||||||
|
|
||||||
|
|
@ -6140,6 +6140,8 @@
|
||||||
|
|
||||||
"destination": "sessions",
|
"destination": "sessions",
|
||||||
|
|
||||||
|
"historyDestination": "history",
|
||||||
|
|
||||||
"class": "ru.clearing.classes.statics.data.misc.Session",
|
"class": "ru.clearing.classes.statics.data.misc.Session",
|
||||||
|
|
||||||
"logUpdates": "true",
|
"logUpdates": "true",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--?xml-stylesheet type="text/xsl" href="\..\corp-reports\src\data\meta\meta.server.xslt"?-->
|
<!--?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" -->
|
<!-- _xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" _xsi:noNamespaceSchemaLocation="file:///E:/d/projects/meta/from/meta.xsd" -->
|
||||||
<!--Здесь словари-->
|
<!--Здесь словари-->
|
||||||
<enums>
|
<enums>
|
||||||
|
|
@ -1414,7 +1414,7 @@
|
||||||
</post>
|
</post>
|
||||||
</actions>
|
</actions>
|
||||||
</launcher>
|
</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"/>
|
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
||||||
<createdAt field="created" type="4" webtype="5" dbname="Дата-время создания записи" name="Время создания записи" shortname="Создано" 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"/>
|
<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": {
|
"enums": {
|
||||||
|
|
||||||
|
|
@ -4764,6 +4764,10 @@
|
||||||
{"code": "accountType",
|
{"code": "accountType",
|
||||||
"type": 12,"name": "Наименование типа счета","shortname": "Тип","link": "accountType","required": true,"visible": false
|
"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",
|
"destination": "sessions",
|
||||||
|
|
||||||
|
"historyDestination": "history",
|
||||||
|
|
||||||
"class": "ru.clearing.classes.statics.data.misc.Session",
|
"class": "ru.clearing.classes.statics.data.misc.Session",
|
||||||
|
|
||||||
"logUpdates": "true",
|
"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)));
|
return new ImdgPredicateHazelcast(Predicates.not(Predicates.equal(key, null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ImdgPredicate isNull(String key) {
|
||||||
|
return new ImdgPredicateHazelcast(Predicates.equal(key, null));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ImdgPredicate in(String key, Comparable[] values) {
|
public ImdgPredicate in(String key, Comparable[] values) {
|
||||||
return new ImdgPredicateHazelcast(Predicates.in(key, 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_SearchExcludeLiabilitiesRegister = "Map_SearchExcludeLiabilitiesRegister";
|
||||||
public static final String Map_SearchLiabilitiesRegister = "Map_SearchLiabilitiesRegister";
|
public static final String Map_SearchLiabilitiesRegister = "Map_SearchLiabilitiesRegister";
|
||||||
public static final String Map_SearchExecutionRegister = "Map_SearchExecutionRegister";
|
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";
|
public static final String MAP_SEQUENCE_NAME = "MAP_SEQUENCE_NAME";
|
||||||
|
|
||||||
private IMDGDistributedNames() {
|
private IMDGDistributedNames() {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ public interface ImdgPredicateBuilder {
|
||||||
ImdgPredicate greater(String key, Comparable value);
|
ImdgPredicate greater(String key, Comparable value);
|
||||||
ImdgPredicate less(String key, Comparable value);
|
ImdgPredicate less(String key, Comparable value);
|
||||||
ImdgPredicate notNull(String key);
|
ImdgPredicate notNull(String key);
|
||||||
|
ImdgPredicate isNull(String key);
|
||||||
|
|
||||||
ImdgPredicate in(String key, Comparable... values);
|
ImdgPredicate in(String key, Comparable... values);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,11 @@ public class ImdgPredicateBuilderSqlMock implements ImdgPredicateBuilder {
|
||||||
return new SimpleSQLPredicate(key + " is not null");
|
return new SimpleSQLPredicate(key + " is not null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ImdgPredicate isNull(String key) {
|
||||||
|
return new SimpleSQLPredicate(key + " is null");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ImdgPredicate in(String key, Comparable[] values) {
|
public ImdgPredicate in(String key, Comparable[] values) {
|
||||||
String enumiration = Arrays.stream(values).map(this::escape).collect(Collectors.joining(", "));
|
String enumiration = Arrays.stream(values).map(this::escape).collect(Collectors.joining(", "));
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue