http://jira.mfd.msk:8088/browse/CLS-252 DDL этап 1, корректировка MoneyMarketSecurityHistory - пока не нужен

This commit is contained in:
AKurakin 2023-03-31 13:54:40 +03:00
parent 3ed83781f2
commit d4d544a086
6 changed files with 1 additions and 148 deletions

View file

@ -462,7 +462,7 @@
<currencyCode type="12" dbname="Код валюты" name="Наименование валюты" shortname="Валюта" searchable="true" sortable="true" visible="true" link="currencyCode" linkCode="code"/>
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
</currency>
<moneyMarketSecurity name="Инструменты Денежного рынка" destination="securities/money-securities" class="ru.clearing.classes.statics.data.misc.MoneyMarketSecurity" logUpdates="true" table="money_market_security">
<moneyMarketSecurity name="Инструменты Денежного рынка" destination="securities/money-securities" class="ru.clearing.classes.statics.data.misc.MoneyMarketSecurity" table="money_market_security">
<securityId type="1" dbname="Идентификатор инструмента" name="Наименование инструмента" shortname="Инструмент" searchable="true" sortable="true" link="security" linkCode="fullName"/>
<description type="2" length="255" name="Описание" shortname="Описание" searchable="true" sortable="false"/>
<startDate type="6" name="Дата начала действия" shortname="Дата начала" searchable="true" sortable="true"/>

View file

@ -1,26 +0,0 @@
package ru.clearing.classes.statics.data.misc;
import ru.clearing.classes.ConstSerializable;
import ru.clearing.classes.objects.BusinessEvent;
import java.io.Serial;
/**
* DB table: MONEY_MARKET_SECURITY_HISTORY
**/
public class MoneyMarketSecurityHistory extends BusinessEvent<MoneyMarketSecurity> {
@Serial
private static final long serialVersionUID = ConstSerializable.serialVersionUID;
private MoneyMarketSecurity object;
@Override
public MoneyMarketSecurity getObject() {
return object;
}
@Override
public void setObject(MoneyMarketSecurity object) {
this.object = object;
}
}

View file

@ -1,113 +0,0 @@
package ru.spcex.clearing.imdg.businessevent;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.clearing.classes.statics.data.misc.MoneyMarketSecurity;
import ru.clearing.classes.statics.data.misc.MoneyMarketSecurityHistory;
import ru.spcex.clearing.imdg.base.TemplateEventMapStore;
import ru.spcex.platform.utils.time.TimeUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Component
public class MoneyMarketSecurityHistoryMapStore extends TemplateEventMapStore<MoneyMarketSecurityHistory> {
public MoneyMarketSecurityHistoryMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getMapName() {
return IMDGDistributedNames.Map_MoneyMarketSecurityHistory;
}
@Override
public String getTableName() {
return "MONEY_MARKET_SECURITY_HISTORY";
}
@Override
public String[] getFields() {
return new String[]{
"ID", "EVENT_TIME", "EVENT_USER_ID", "EVENT_TYPE",
"MONEY_MARKET_SECURITY_ID", "SECURITY_ID", "DESCRIPTION", "START_DATE", "END_DATE", "NOMINAL_VALUE", "NOMINAL_CURRENCY", "TERM_TYPE", "LOT_SIZE"};
}
public String[] getFieldsSecurity() {
return new String[]{
"ID", "EVENT_TIME", "EVENT_USER_ID", "EVENT_TYPE",
"SECURITY_ID", "CREATED_AT", "UPDATED_AT", "INSTRUMENT_TYPE", "ISSUER_ID", "SHORT_NAME", "FULL_NAME", "SHORT_NAME_ENG", "FULL_NAME_ENG", "SECURITY_SYMBOL", "ISIN", "WORKFLOW_STATUS"};
}
private final String insertToSecurityStatement = makeInsertSql("SECURITY",
getFieldsSecurity(), "id");
@Override
protected Object[] objectToField(MoneyMarketSecurityHistory historyLog) {
MoneyMarketSecurity moneyMarketSecurity = historyLog.getObject();
Object[] args = new Object[]{
historyLog.getId(),
historyLog.getEventTime(),
historyLog.getUserId(),
historyLog.getEventType(),
moneyMarketSecurity.getId(),
moneyMarketSecurity.getSecurityId(),
moneyMarketSecurity.getDescription(),
TimeUtil.toDateFromLocalDate(moneyMarketSecurity.getStartDate()),
TimeUtil.toDateFromLocalDate(moneyMarketSecurity.getEndDate()),
moneyMarketSecurity.getNominalValue(),
moneyMarketSecurity.getNominalCurrency(),
moneyMarketSecurity.getTermType(),
moneyMarketSecurity.getLotSize()
};
return args;
}
protected Object[] securityField(MoneyMarketSecurityHistory historyLog) {
MoneyMarketSecurity object = historyLog.getObject();
Object[] args = new Object[]{
historyLog.getId(),
historyLog.getEventTime(),
historyLog.getUserId(),
historyLog.getEventType(),
object.getSecurityId(),
TimeUtil.toDateFromInstant(object.getCreated()),
TimeUtil.toDateFromInstant(object.getUpdated()),
object.getInstrumentType(),
object.getIssuerId(),
object.getShortName(),
object.getFullName(),
object.getShortNameEng(),
object.getFullNameEng(),
object.getSecuritySymbol(),
object.getIsin(),
object.getWorkflowStatus()
};
return args;
}
@Override
public void store(Map<Long, MoneyMarketSecurityHistory> map) {
List<Object[]> moneyMarketArgs = new ArrayList<>();
List<Object[]> securityArgs = new ArrayList<>();
for (Map.Entry<Long, MoneyMarketSecurityHistory> entry : map.entrySet()) {
MoneyMarketSecurityHistory obj = entry.getValue();
Object[] args = objectToField(obj);
if (args.length != validateSize) {
throw new IllegalArgumentException("objectToField return " + args.length + " arguments, but expected " + validateSize);
}
moneyMarketArgs.add(args);
securityArgs.add(securityField(obj));
}
batchInsertUpdate(insertStatement, moneyMarketArgs);
batchInsertUpdate(insertToSecurityStatement, securityArgs);
}
}

View file

@ -43,7 +43,6 @@ public class UpdateMapService extends AbstractUpdateMapService {
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_UserConnect).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_User).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_Currency).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_MoneyMarketSecurity).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_Listing).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_MarketHistory).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
}
@ -102,11 +101,6 @@ public class UpdateMapService extends AbstractUpdateMapService {
createBusinessEvent(currencyHistory, eventType);
currencyHistory.setObject((Currency) value);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_CurrencyHistory).put(currencyHistory.getId(), currencyHistory);
} else if (value instanceof MoneyMarketSecurity) {
MoneyMarketSecurityHistory moneyMarketSecurityHistory = new MoneyMarketSecurityHistory();
createBusinessEvent(moneyMarketSecurityHistory, eventType);
moneyMarketSecurityHistory.setObject((MoneyMarketSecurity) value);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_MoneyMarketSecurityHistory).put(moneyMarketSecurityHistory.getId(), moneyMarketSecurityHistory);
} else if (value instanceof Listing) {
ListingHistory listingHistory = new ListingHistory();
createBusinessEvent(listingHistory, eventType);

View file

@ -69,7 +69,6 @@ public class RunnableMapNamesForTesting {
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_UserConnectHistory, UserConnectHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_UserHistory, UserHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_CurrencyHistory, CurrencyHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_MoneyMarketSecurityHistory, MoneyMarketSecurityHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_ListingHistory, ListingHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_MarketHistory, MarketHistory.class));

View file

@ -126,7 +126,6 @@ public final class IMDGDistributedNames {
public static final String Map_ShareTypeDictionary = "Map_ShareTypeDictionary";
public static final String Map_BondTypeDictionary = "Map_BondTypeDictionary";
public static final String Map_CurrencyHistory = "Map_CurrencyHistory";
public static final String Map_MoneyMarketSecurityHistory = "Map_MoneyMarketSecurityHistory";
public static final String Map_EquitySecurity = "Map_EquitySecurity";
public static final String Map_FixedIncomeSecurity = "Map_FixedIncomeSecurity";
public static final String Map_FixedIncomeCashFlow = "Map_FixedIncomeCashFlow";