Added tests for dictionary MapStore(with CompanyHistoryMapStore)

This commit is contained in:
psemenkov 2022-10-12 15:01:46 +03:00
parent 1adfb2f7a7
commit b53dfda7a1
23 changed files with 429 additions and 286 deletions

View file

@ -1,12 +1,12 @@
//package ru.clearing.platform.dictionary;
//
///**
// * Справочник статусов возваращения процентов
// *
// * Dictionary DB table: INTEREST_STATUS_DICTIONARY
// **/
//public class InterestStatusDictionary extends AbstractDictionary {
// private static final long serialVersionUID = ConstDictionarySerializable.serialVersionUID;
//
//
//}
package ru.clearing.platform.dictionary;
/**
* Справочник статусов возваращения процентов
* <p>
* Dictionary DB table: INTEREST_STATUS_DICTIONARY
**/
public class InterestStatusDictionary extends AbstractDictionary {
private static final long serialVersionUID = ConstDictionarySerializable.serialVersionUID;
}

View file

@ -2,6 +2,7 @@ package ru.spcex.clearing.imdg.businessevent;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Component;
import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.classes.statics.data.company.CompanyHistory;
import ru.clearing.classes.statics.data.profile.CompanyInfo;
@ -13,9 +14,12 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
//@Component
@Component
public class CompanyHistoryMapStore extends BusinessEventMapStore<CompanyHistory> {
protected final String insertStatement = makeInsertSql(getTableName(), getFields(), "id");
protected final String insertCompanyInfoStatement = makeInsertSql("COMPANY_INFO_HISTORY", getFieldsForCompanyInfo(), "id");
public CompanyHistoryMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@ -42,9 +46,6 @@ public class CompanyHistoryMapStore extends BusinessEventMapStore<CompanyHistory
};
}
protected final String insertStatement = makeInsertSql(getTableName(), getFields(), "id");
protected final String insertCompanyInfoStatement = makeInsertSql("COMPANY_INFO", getFieldsForCompanyInfo(), "id");
@Override
public void store(Map<Long, CompanyHistory> map) {
List<Object[]> batchArgs = new ArrayList<>();

View file

@ -16,7 +16,6 @@ public class HazelcastConfiguration {
private final PoolMapConfigs poolMapConfigs;
private final HazelcastServerSettings hzSettings;
private final ConfigurationRootElement configRoot = DfaConfig.get().getRoot();
@Autowired
public HazelcastConfiguration(PoolMapConfigs poolMapConfigs,
@ -52,13 +51,8 @@ public class HazelcastConfiguration {
)
);
// config.addMapConfig(poolMapConfigs.map_CompanyRoleSet()); todo протестировать автоконфигуратор конфигурации мапсторов
config.addMapConfig(poolMapConfigs.map_CompanySymbols());
config.addMapConfig(poolMapConfigs.map_ProfileDocument());
config.addMapConfig(poolMapConfigs.map_Contact());
config.addMapConfig(poolMapConfigs.map_Company());
// config.addMapConfig(poolMapConfigs.map_CompanyUpdate());
config.addMapConfig(poolMapConfigs.map_Company()); //todo убедиться, что CompanyMapStore extends BusinessObjectMapStore теперь будет TemplateMapStore.
config.addMapConfig(poolMapConfigs.map_CompanyHistory());
// Автоподключение мап
List<MapConfig> autoMapCfg = poolMapConfigs.autoconfiguratorOfMapstorages();
for (MapConfig cfg : autoMapCfg) {

View file

@ -12,10 +12,6 @@ import ru.spcex.clearing.imdg.base.AutoconfiguredMap;
import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
import ru.spcex.clearing.imdg.businessevent.CompanyHistoryMapStore;
import ru.spcex.clearing.imdg.businessobject.CompanyMapStore;
import ru.spcex.clearing.imdg.dictionary.*;
import ru.spcex.clearing.imdg.object.CompanySymbolsMapStore;
import ru.spcex.clearing.imdg.object.ContactMapStore;
import ru.spcex.clearing.imdg.object.ProfileDocumentMapStore;
import java.util.ArrayList;
import java.util.Arrays;
@ -24,12 +20,21 @@ import java.util.List;
@Configuration
public class PoolMapConfigs {
private Logger log = LoggerFactory.getLogger(getClass());
private final Logger log = LoggerFactory.getLogger(getClass());
@Autowired
private CompanyMapStore companyMapStore;
@Autowired
private CompanyHistoryMapStore companyHistoryMapStore;
// Автоконфигурируемые мапсторы:
@Autowired
private List<AutoconfiguredMap<?>> listOfAutopluginStores;
private MapStoreConfig makeDefaultMapStoreConfig(MapLoader<Long, ?> mapBean) {
return new MapStoreConfig()
.setImplementation(mapBean)
;//todo config: .setWriteDelaySeconds(configRoot.getIMDG().getDbSyncSeconds());
;//todo config: .setWriteDelaySeconds(configRoot.getIMDG().getDbSyncSeconds());
}
public ScheduledExecutorConfig makeDefaultScheduledExecutorConfig(String name) {
@ -67,82 +72,13 @@ public class PoolMapConfigs {
return makeMapIndexConfig(attributeName, false);
}
@Autowired private AllowedDictionaryMapStore allowedDictionaryMapStore;
public MapConfig map_AllowedDictionary() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_AllowedDictionary, allowedDictionaryMapStore)
.setNearCacheConfig(makeDefaultNearCacheConfig())
.addMapIndexConfig(makeMapIndexConfig("code"));
}
@Autowired private CompanyRoleDictionaryMapStore companyRoleDictionaryMapStore;
public MapConfig map_CompanyRoleDictionary() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_CompanyRoleDictionary, companyRoleDictionaryMapStore)
.setNearCacheConfig(makeDefaultNearCacheConfig())
.addMapIndexConfig(makeMapIndexConfig("code"));
}
@Autowired private CompanySymbolDictionaryMapStore companySymbolDictionaryMapStore;
public MapConfig map_CompanySymbolDictionary() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_CompanySymbolDictionary, companySymbolDictionaryMapStore)
.setNearCacheConfig(makeDefaultNearCacheConfig())
.addMapIndexConfig(makeMapIndexConfig("code"));
}
@Autowired private ContactTypeDictionaryMapStore contactTypeDictionaryMapStore;
public MapConfig map_ContactTypeDictionary() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_ContactTypeDictionary, contactTypeDictionaryMapStore)
.setNearCacheConfig(makeDefaultNearCacheConfig())
.addMapIndexConfig(makeMapIndexConfig("code"));
}
@Autowired private CorporationSoleTypeDictionaryMapStore corporationSoleTypeDictionaryMapStore;
public MapConfig map_CorporationSoleTypeDictionary() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_CorporationSoleTypeDictionary, corporationSoleTypeDictionaryMapStore)
.setNearCacheConfig(makeDefaultNearCacheConfig())
.addMapIndexConfig(makeMapIndexConfig("code"));
}
@Autowired private CountryCodeDictionaryMapStore countryCodeDictionaryMapStore;
public MapConfig map_CountryCodeDictionary() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_CountryCodeDictionary, countryCodeDictionaryMapStore)
.setNearCacheConfig(makeDefaultNearCacheConfig())
.addMapIndexConfig(makeMapIndexConfig("code"));
}
@Autowired private DocumentTypeDictionaryMapStore documentTypeDictionaryMapStore;
public MapConfig map_DocumentTypeDictionary() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_DocumentTypeDictionary, documentTypeDictionaryMapStore)
.setNearCacheConfig(makeDefaultNearCacheConfig())
.addMapIndexConfig(makeMapIndexConfig("code"));
}
@Autowired private LegalKindDictionaryMapStore legalKindDictionaryMapStore;
public MapConfig map_LegalKindDictionary() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_LegalKindDictionary, legalKindDictionaryMapStore)
.setNearCacheConfig(makeDefaultNearCacheConfig())
.addMapIndexConfig(makeMapIndexConfig("code"));
}
@Autowired private OrganizationTypeDictionaryMapStore organizationTypeDictionaryMapStore;
public MapConfig map_OrganizationTypeDictionary() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_OrganizationTypeDictionary, organizationTypeDictionaryMapStore)
.setNearCacheConfig(makeDefaultNearCacheConfig())
.addMapIndexConfig(makeMapIndexConfig("code"));
}
@Autowired private WorkflowStatusDictionaryMapStore workflowStatusDictionaryMapStore;
public MapConfig map_WorkflowStatusDictionary() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_WorkflowStatusDictionary, workflowStatusDictionaryMapStore)
.setNearCacheConfig(makeDefaultNearCacheConfig())
.addMapIndexConfig(makeMapIndexConfig("code"));
}
@Autowired
private CompanyMapStore companyMapStore;
public MapConfig map_Company() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_Company, companyMapStore);
}
// Автоконфигурируемые мапсторы:
@Autowired
private List<AutoconfiguredMap<?>> listOfAutopluginStores;
public MapConfig map_CompanyHistory() {
return makeDefaultMapConfig(IMDGDistributedNames.Map_CompanyHistory, companyHistoryMapStore);
}
// @Qualifier("AutoconfiguredMapStore")
public List<MapConfig> autoconfiguratorOfMapstorages() {
@ -173,7 +109,7 @@ public class PoolMapConfigs {
}
out.add(mapCfg);
} catch (RuntimeException e) {
throw new RuntimeException("Can not configure MapStore " + mapStore.getMapName() + "(" + mapStore.toString() + "): " + e, e);
throw new RuntimeException("Can not configure MapStore " + mapStore.getMapName() + "(" + mapStore + "): " + e, e);
}
}
log.debug("Configured {} mapStore's", out.size());

View file

@ -1,31 +1,31 @@
//package ru.spcex.clearing.imdg.dictionary;
//
//import org.springframework.jdbc.core.JdbcTemplate;
//import org.springframework.stereotype.Component;
//import ru.clearing.platform.dictionary.InterestStatusDictionary;
//import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
//import ru.spcex.clearing.imdg.IMDGDistributedNames;
//
//@Component
//public class InterestStatusDictionaryMapStore extends DictionaryTMapStore<InterestStatusDictionary> {
//
// public InterestStatusDictionaryMapStore(JdbcTemplate jdbcTemplate) {
// super(jdbcTemplate);
// }
//
// @Override
// public String getMapName() {
// return IMDGDistributedNames.Map_InterestStatusDictionary;
// }
//
// @Override
// public String getTableName() {
// return "INTEREST_STATUS_DICTIONARY";
// }
//
// @Override
// public InterestStatusDictionary getDictionaryObject() {
// return new InterestStatusDictionary();
// }
//
//}
package ru.spcex.clearing.imdg.dictionary;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import ru.clearing.platform.dictionary.InterestStatusDictionary;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
@Component
public class InterestStatusDictionaryMapStore extends DictionaryTMapStore<InterestStatusDictionary> {
public InterestStatusDictionaryMapStore(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate);
}
@Override
public String getMapName() {
return IMDGDistributedNames.Map_InterestStatusDictionary;
}
@Override
public String getTableName() {
return "INTEREST_STATUS_DICTIONARY";
}
@Override
public InterestStatusDictionary getDictionaryObject() {
return new InterestStatusDictionary();
}
}

View file

@ -7,8 +7,17 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ru.clearing.classes.statics.data.account.*;
import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.classes.statics.data.company.CompanyHistory;
import ru.clearing.classes.statics.data.company.relation.Relation;
import ru.clearing.classes.statics.data.company.relation.RelationHistory;
import ru.clearing.classes.statics.data.security.Security;
import ru.clearing.classes.statics.data.security.SecurityHistory;
import ru.clearing.classes.statics.data.user.User;
import ru.clearing.classes.statics.data.user.UserConnect;
import ru.clearing.classes.statics.data.user.UserConnectHistory;
import ru.clearing.classes.statics.data.user.UserHistory;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
@Service
@ -22,18 +31,72 @@ public class UpdateMapService extends AbstractUpdateMapService {
@Override
public void addingListenersToCards() {
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_AccountBalance).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_Account).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_AccountRouting).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_BankAccount).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_Company).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_InformationAccount).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_Relation).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_Security).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_UserConnect).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_User).addLocalEntryListener(this, Predicates.alwaysTrue(), true);
}
@Override
protected void entryModified(EntryEvent<Long, Object> event, String eventType) {
log.debug("{} {}", event, eventType);
Object value = (EVENT_DELETE.equals(eventType) ? event.getOldValue() : event.getValue());
if (value instanceof Company) {
if (value instanceof AccountBalance) {
AccountBalanceHistory accountBalanceHistory = new AccountBalanceHistory();
createBusinessEvent(accountBalanceHistory, eventType);
accountBalanceHistory.setObject((AccountBalance) value);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_AccountBalanceHistory).put(accountBalanceHistory.getId(), accountBalanceHistory);
} else if (value instanceof Account) {
AccountHistory accountHistory = new AccountHistory();
createBusinessEvent(accountHistory, eventType);
accountHistory.setObject((Account) value);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_AccountHistory).put(accountHistory.getId(), accountHistory);
} else if (value instanceof AccountRouting) {
AccountRoutingHistory accountRoutingHistory = new AccountRoutingHistory();
createBusinessEvent(accountRoutingHistory, eventType);
accountRoutingHistory.setObject((AccountRouting) value);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_AccountRoutingHistory).put(accountRoutingHistory.getId(), accountRoutingHistory);
} else if (value instanceof BankAccount) {
BankAccountHistory bankAccountHistory = new BankAccountHistory();
createBusinessEvent(bankAccountHistory, eventType);
bankAccountHistory.setObject((BankAccount) value);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_BankAccountHistory).put(bankAccountHistory.getId(), bankAccountHistory);
} else if (value instanceof Company) {
CompanyHistory companyHistory = new CompanyHistory();
createBusinessEvent(companyHistory, eventType);
companyHistory.setObject((Company) value);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_CompanyHistory).put(companyHistory.getId(), companyHistory);
} else if (value instanceof InformationAccount) {
InformationAccountHistory informationAccountHistory = new InformationAccountHistory();
createBusinessEvent(informationAccountHistory, eventType);
informationAccountHistory.setObject((InformationAccount) value);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_InformationAccountHistory).put(informationAccountHistory.getId(), informationAccountHistory);
} else if (value instanceof Relation) {
RelationHistory relationHistory = new RelationHistory();
createBusinessEvent(relationHistory, eventType);
relationHistory.setObject((Relation) value);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_RelationHistory).put(relationHistory.getId(), relationHistory);
} else if (value instanceof Security) {
SecurityHistory securityHistory = new SecurityHistory();
createBusinessEvent(securityHistory, eventType);
securityHistory.setObject((Security) value);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_SecurityHistory).put(securityHistory.getId(), securityHistory);
} else if (value instanceof UserConnect) {
UserConnectHistory userConnectHistory = new UserConnectHistory();
createBusinessEvent(userConnectHistory, eventType);
userConnectHistory.setObject((UserConnect) value);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_UserConnectHistory).put(userConnectHistory.getId(), userConnectHistory);
} else if (value instanceof User) {
UserHistory userHistory = new UserHistory();
createBusinessEvent(userHistory, eventType);
userHistory.setObject((User) value);
hazelcastServerInstance.getMap(IMDGDistributedNames.Map_UserHistory).put(userHistory.getId(), userHistory);
} else {
log.error("unexpected event {}", event);
}

View file

@ -2,7 +2,6 @@ imdg.hazelcast.listenPort=5701
imdg.hazelcast.login=dev
imdg.hazelcast.password=dev-pass
imdg.hazelcast.cluster-members[0]=127.0.0.1
imdg.database.login=clearing
imdg.database.password=Aa111111
imdg.database.url=jdbc:postgresql://10.200.200.133:5432/postgres

View file

@ -20,6 +20,9 @@ import org.springframework.lang.NonNull;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.classes.statics.data.company.CompanyHistory;
import ru.clearing.classes.statics.data.profile.CompanyInfo;
import ru.clearing.platform.dictionary.AbstractDictionary;
import ru.clearing.platform.dictionary.CompanySymbolDictionary;
import ru.spcex.clearing.imdg.base.*;
@ -29,6 +32,7 @@ import ru.spcex.clearing.imdg.structure.BusinessObjectAndBusinessEventForCheckMa
import ru.spcex.clearing.imdg.structure.DictionaryObjectForCheckMapStore;
import ru.spcex.clearing.imdg.utils.BusinessEventRowMapper;
import ru.spcex.clearing.imdg.utils.DbDataUtils;
import ru.spcex.clearing.imdg.utils.SpcexObjectBaseRowMapper;
import ru.spcex.platform.classes.base.SpcexObjectBase;
import ru.spcex.platform.utils.text.TextUtil;
@ -38,8 +42,8 @@ import java.sql.*;
import java.util.*;
import java.util.stream.Collectors;
import static ru.spcex.clearing.imdg.structure.GeneratorMapNamesForHazelcast.businessObjectAndBusinessEventForCheckMapStores;
import static ru.spcex.clearing.imdg.structure.GeneratorMapNamesForHazelcast.dictionaryObjectForCheckMapStores;
import static ru.spcex.clearing.imdg.structure.RunnableMapNamesForTesting.businessObjectAndBusinessEventForCheckMapStores;
import static ru.spcex.clearing.imdg.structure.RunnableMapNamesForTesting.dictionaryObjectForCheckMapStores;
@ContextConfiguration(classes = {
TestConfiguration.class,
@ -61,7 +65,21 @@ public class AllMapStoreTest {
for (BusinessObjectAndBusinessEventForCheckMapStore<SpcexObjectBase> objectForCheck : businessObjectAndBusinessEventForCheckMapStores) {
SpcexObjectBase object = objectForCheck.getClazz().getDeclaredConstructor().newInstance();
DbDataUtils.fillObjectDefaultValues(object, object.getClass());
objectForCheck.setPredictableObj(object);
if (objectForCheck.getClazz().equals(CompanyHistory.class)) {
CompanyHistory companyHistory = (CompanyHistory) object;
CompanyInfo companyInfo = companyHistory.getObject().getProfile();
companyInfo.setCompanyId(companyHistory.getObject().getId());
companyInfo.setId(1000000L);
objectForCheck.setPredictableObj(companyHistory);
} else if (objectForCheck.getClazz().equals(Company.class)) {
Company company = (Company) object;
CompanyInfo companyInfo = company.getProfile();
companyInfo.setCompanyId(1000000L);
companyInfo.setId(1000000L);
objectForCheck.setPredictableObj(company);
} else {
objectForCheck.setPredictableObj(object);
}
}
for (DictionaryObjectForCheckMapStore<AbstractDictionary> objectForCheck : dictionaryObjectForCheckMapStores) {
AbstractDictionary object = objectForCheck.getClazz().getDeclaredConstructor().newInstance();
@ -104,6 +122,8 @@ public class AllMapStoreTest {
tableName = ((TemplateEventMapStore<?>) mapStore).getTableName();
} else if (mapStore instanceof BusinessObjectMapStore) {
tableName = ((BusinessObjectMapStore<?>) mapStore).getTableName();
} else if (mapStore instanceof BusinessEventMapStore) {
tableName = ((BusinessEventMapStore<?>) mapStore).getTableName();
} else if (mapName.equals("default")) {
continue;
} else {
@ -112,9 +132,9 @@ public class AllMapStoreTest {
}
nameTables.remove(tableName.toLowerCase());
}
System.out.println("** Результата поиска таблиц которым нужно добавить mapStore **");
System.out.println("** Результат поиска таблиц которым нужно добавить mapStore **");
nameTables.forEach(System.out::println);
System.out.println("**************************************************************");
System.out.println("*************************************************************");
Assertions.assertEquals(0, nameTables.size());
}
@ -132,6 +152,15 @@ public class AllMapStoreTest {
String sql = String.format("SELECT * FROM %s WHERE id = %d", getTableNameFromMapStore(objectForCheck.getMapName()), ID);
List<SpcexObjectBase> obj = jdbcTemplate.query(sql, new BusinessEventRowMapper<>(objectForCheck.getClazz()));
actual = DataAccessUtils.singleResult(obj);
} else if (getMapStore(mapName) instanceof BusinessEventMapStore) {
String sql = String.format("SELECT * FROM %s WHERE id = %d", getTableNameFromMapStore(objectForCheck.getMapName()), ID);
List<CompanyHistory> objCompanyHistory = jdbcTemplate.query(sql, new BusinessEventRowMapper<>(objectForCheck.getClazz()));
CompanyHistory companyHistory = DataAccessUtils.singleResult(objCompanyHistory);
String sqlI = String.format("SELECT * FROM %s WHERE id = %d", "COMPANY_INFO_HISTORY", ID);
List<CompanyInfo> objCompanyInfo = jdbcTemplate.query(sqlI, new SpcexObjectBaseRowMapper<>(CompanyInfo.class));
CompanyInfo companyInfo = DataAccessUtils.singleResult(objCompanyInfo);
companyHistory.getObject().setProfile(companyInfo);
actual = companyHistory;
} else {
IMap<Long, SpcexObjectBase> map = testConfig.getHazelcastInstance().getMap(mapName);
actual = map.get(ID);
@ -176,6 +205,8 @@ public class AllMapStoreTest {
tableName = ((TemplateEventMapStore<?>) mapStore).getTableName();
} else if (mapStore instanceof BusinessObjectMapStore) {
tableName = ((BusinessObjectMapStore<?>) mapStore).getTableName();
} else if (mapStore instanceof BusinessEventMapStore) {
tableName = ((BusinessEventMapStore<?>) mapStore).getTableName();
}
return tableName;
}
@ -191,7 +222,6 @@ public class AllMapStoreTest {
SpcexObjectBase spcexObjectBase = objectForCheck.getPredictableObj();
spcexObjectBase.setId(ID);
log.info("Запись в мап {} объекта {}", mapName, spcexObjectBase);
Object mapStore = getMapStore(mapName);
IMap<Long, SpcexObjectBase> map = testConfig.getHazelcastInstance().getMap(mapName);
map.put(spcexObjectBase.getId(), spcexObjectBase);
}

View file

@ -19,8 +19,6 @@ import java.sql.Connection;
public class DbTestConnectionConfig {
private final Logger log = LoggerFactory.getLogger(this.getClass());
private final ConfigurationRootElement configRoot = DfaConfig.get().getRoot();
private DatabasePopulator createDatabasePopulator() {
ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator();
databasePopulator.setContinueOnError(true);
@ -35,7 +33,7 @@ public class DbTestConnectionConfig {
String password = "Aa111111";
String logTimeoutPart = "";
String dbPath = "jdbc:postgresql://10.200.200.133:5432/postgres?currentSchema=clearing_tester";
int timeoutSec = configRoot.getDatabase().getConnectionAcquireTimeoutSeconds();
int timeoutSec = 30;
ComboPooledDataSource cpds = new ComboPooledDataSource();
try {
@ -46,11 +44,12 @@ public class DbTestConnectionConfig {
cpds.setJdbcUrl(dbPath);
cpds.setUser(login);
cpds.setPassword(password);
cpds.setInitialPoolSize(configRoot.getDatabase().getMinPoolSize());
cpds.setMinPoolSize(configRoot.getDatabase().getMinPoolSize());
cpds.setMaxPoolSize(configRoot.getDatabase().getMaxPoolSize());
cpds.setNumHelperThreads(configRoot.getDatabase().getNumHelperThreads());
cpds.setCheckoutTimeout(timeoutSec * 1000/*todo common 1000==ConstsCommon.SECOND*/);
cpds.setInitialPoolSize(10);
cpds.setMinPoolSize(01);
cpds.setMaxPoolSize(30);
int numHelperThreads = Runtime.getRuntime().availableProcessors() * 2;
cpds.setNumHelperThreads(numHelperThreads);
cpds.setCheckoutTimeout(timeoutSec * 1000);
logTimeoutPart = String.format(" (timeout=%ds)", timeoutSec);
// DatabasePopulatorUtils.execute(createDatabasePopulator(), cpds);
result = cpds;

View file

@ -2,6 +2,7 @@ package ru.spcex.clearing.imdg.structure;
import ru.clearing.classes.statics.data.account.*;
import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.classes.statics.data.company.CompanyHistory;
import ru.clearing.classes.statics.data.company.relation.Relation;
import ru.clearing.classes.statics.data.company.relation.RelationHistory;
import ru.clearing.classes.statics.data.messages.ErrorText;
@ -24,7 +25,7 @@ import java.math.BigDecimal;
import java.util.LinkedList;
import java.util.List;
public class GeneratorMapNamesForHazelcast {
public class RunnableMapNamesForTesting {
public static List<BusinessObjectAndBusinessEventForCheckMapStore> businessObjectAndBusinessEventForCheckMapStores;
public static List<DictionaryObjectForCheckMapStore> dictionaryObjectForCheckMapStores;
@ -41,7 +42,7 @@ public class GeneratorMapNamesForHazelcast {
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_AccountHistory, AccountHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_AccountRoutingHistory, AccountRoutingHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_BankAccountHistory, BankAccountHistory.class));
// objectForCheckMapStores.add(new ObjectForCheckMapStore<>(IMDGDistributedNames.Map_CompanyHistory, CompanyHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_CompanyHistory, CompanyHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_InformationAccountHistory, InformationAccountHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_RelationHistory, RelationHistory.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_SecurityHistory, SecurityHistory.class));
@ -80,5 +81,33 @@ public class GeneratorMapNamesForHazelcast {
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_CourierTypeDictionary, CourierTypeDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_CurrencyCodeDictionary, CurrencyCodeDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_DocumentTypeDictionary, DocumentTypeDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ErrorCodeDictionary, ErrorCodeDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_InOutDirectionDictionary, InOutDirectionDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_InstrumentTypeDictionary, InstrumentTypeDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_InterestStatusDictionary, InterestStatusDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_LegalKindDictionary, LegalKindDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ManagementJournalPurposeDictionary, ManagementJournalPurposeDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ManagementJournalStatusDictionary, ManagementJournalStatusDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ManagementJournalTypeDictionary, ManagementJournalTypeDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_MoneyFlowSideDictionary, MoneyFlowSideDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_OperationStatusDictionary, OperationStatusDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_OperationTypeDictionary, OperationTypeDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_OrganizationTypeDictionary, OrganizationTypeDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ResultStatusDictionary, ResultStatusDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_SectorDictionary, SectorDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ServiceDictionary, ServiceDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ServiceProductDictionary, ServiceProductDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_ServiceStatusDictionary, ServiceStatusDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_SourceDictionary, SourceDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_StatementTypeDictionary, StatementTypeDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_TaskDictionary, TaskDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_TaskStatusDictionary, TaskStatusDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_TermTypeDictionary, TermTypeDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_TradingStatusDictionary, TradingStatusDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_UserRoleDictionary, UserRoleDictionary.class));
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_WorkflowStatusDictionary, WorkflowStatusDictionary.class));
//object
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_AccountRouting, AccountRouting.class));
}
}

View file

@ -0,0 +1,74 @@
package ru.spcex.clearing.imdg.utils;
import org.springframework.jdbc.core.RowMapper;
import ru.spcex.platform.classes.base.SpcexObjectBase;
import java.lang.reflect.Field;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.ZoneId;
import java.util.Date;
public abstract class AbstractHistoryRowMapper<T extends SpcexObjectBase> implements RowMapper<T> {
@Override
abstract public T mapRow(ResultSet rs, int rowNum) throws SQLException;
protected void setValueFildForObjectIfFildExists(SpcexObjectBase object, Class<?> clazz, String fildName, Object value) {
try {
Field field = clazz.getDeclaredField(fildName);
field.setAccessible(true);
Class<?> typeField = field.getType();
if (typeField.equals(LocalDate.class)) {
Date date = (Date) value;
field.set(object, value != null ? Instant.ofEpochMilli(date.getTime()).atZone(ZoneId.systemDefault()).toLocalDate() : null);
} else if (typeField.equals(LocalTime.class)) {
Time time = (Time) value;
field.set(object, value != null ? time.toLocalTime() : null);
} else if (typeField.getName().equals(Instant.class.getName())) {
field.set(object, value != null ? ((Timestamp) value).toInstant() : null);
} else {
field.set(object, value);
}
} catch (NoSuchFieldException e) {
if (!clazz.getSuperclass().getName().equals(Object.class.getName())) {
setValueFildForObjectIfFildExists(object, clazz.getSuperclass(), fildName, value);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
protected String getFildName(String str, String objIdColumn) {
if (str.equals(objIdColumn)) {
return "objId";
} else if (str.equals("created_at")) {
return "created";
} else if (str.equals("updated_at")) {
return "updated";
}
return snakeCaseToCamelCase(str);
}
protected String snakeCaseToCamelCase(String str) {
StringBuilder builder = new StringBuilder(str);
for (int i = 0; i < builder.length(); i++) {
// Check char is underscore
if (builder.charAt(i) == '_') {
builder.deleteCharAt(i);
builder.replace(
i, i + 1,
String.valueOf(
Character.toUpperCase(
builder.charAt(i))));
}
}
return builder.toString();
}
}

View file

@ -0,0 +1,65 @@
package ru.spcex.clearing.imdg.utils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.NotWritablePropertyException;
import org.springframework.beans.TypeMismatchException;
import org.springframework.jdbc.support.JdbcUtils;
import ru.clearing.classes.objects.BusinessEvent;
import ru.spcex.platform.classes.base.SpcexObjectBase;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
public class BusinessEventRowMapper<T extends BusinessEvent> extends AbstractHistoryRowMapper<T> {
private final Class<T> mappedClass;
public BusinessEventRowMapper(Class<T> mappedClass) {
this.mappedClass = mappedClass;
}
@Override
public T mapRow(ResultSet rs, int rowNum) throws SQLException {
T historyObject = BeanUtils.instantiateClass(this.mappedClass);
SpcexObjectBase objectFild = null;
try {
objectFild = (SpcexObjectBase) BeanUtils.instantiateClass(historyObject.getClass().getDeclaredField("object").getType());
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
}
ResultSetMetaData meta_data = rs.getMetaData();
String objIdColumn = rs.getMetaData().getTableName(1).replace("_history", "_id");
int columnCount = meta_data.getColumnCount();
for (int index = 1; index <= columnCount; index++) {
String column = JdbcUtils.lookupColumnName(meta_data, index);
String fildName = getFildName(column, objIdColumn);
try {
Object value = JdbcUtils.getResultSetValue(rs, index, Class.forName(meta_data.getColumnClassName(index)));
if (fildName.equals("id")) {
historyObject.setId((Long) value);
continue;
} else if (fildName.equals("eventUserId")) {
historyObject.setUserId((Long) value);
continue;
} else if (fildName.equals("userId")) {
setValueFildForObjectIfFildExists(objectFild, objectFild.getClass(), fildName, value);
continue;
} else if (fildName.equals("objId")) {
objectFild.setId((Long) value);
continue;
}
setValueFildForObjectIfFildExists(historyObject, historyObject.getClass(), fildName, value);
setValueFildForObjectIfFildExists(objectFild, objectFild.getClass(), fildName, value);
} catch (TypeMismatchException | NotWritablePropertyException e) {
// Ignore
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
historyObject.setObject(objectFild);
return historyObject;
}
}

View file

@ -187,17 +187,17 @@ public final class DbDataUtils {
Class<?> typeField = field.getType();
try {
if (typeField.getName().equals(String.class.getName())) {
field.set(object, "qwer");
field.set(object, generatingRandomString(4));
} else if (typeField.equals(Integer.TYPE) || typeField.equals(Integer.class)) {
field.set(object, 0);
field.set(object, generatingRandomInteger());
} else if (typeField.getName().equals(BigDecimal.class.getName())) {
field.set(object, new BigDecimal("23.220000000000000000"));
field.set(object, new BigDecimal(String.format("%d3.220000000000000000", generatingRandomInteger())));
} else if (typeField.equals(Long.TYPE) || typeField.equals(Long.class)) {
field.set(object, 1000000L);
field.set(object, generatingRandomLong());
} else if (typeField.equals(LocalDate.class)) {
field.set(object, LocalDate.of(2022, 10, 7));
field.set(object, LocalDate.of(2022, generatingRandomInteger(), generatingRandomInteger()));
} else if (typeField.equals(LocalTime.class)) {
field.set(object, LocalTime.of(19, 0));
field.set(object, LocalTime.of(generatingRandomInteger(), generatingRandomInteger()));
} else if (typeField.getName().equals(Date.class.getName())) {
field.set(object, new Date());
} else if (typeField.getName().equals(Boolean.class.getName())) {
@ -205,7 +205,7 @@ public final class DbDataUtils {
} else if (typeField.getName().equals(UUID.class.getName())) {
field.set(object, UUID.randomUUID());
} else if (typeField.getName().equals(Instant.class.getName())) {
field.set(object, Instant.parse("2022-10-05T15:39:18.659Z"));
field.set(object, Instant.parse(String.format("2022-10-0%dT15:39:18.659Z", generatingRandomInteger())));
// } else if (typeField.getSimpleName().equals(CompanyInfo.class.getSimpleName())) {
// CompanyInfo companyInfo = new CompanyInfo();
// fillObjectDefaultValues(companyInfo, CompanyInfo.class);
@ -225,4 +225,27 @@ public final class DbDataUtils {
throw new RuntimeException(e);
}
}
public static String generatingRandomString(int targetStringLength) {
int leftLimit = 97; // letter 'a'
int rightLimit = 122; // letter 'z'
Random random = new Random();
return random.ints(leftLimit, rightLimit + 1)
.limit(targetStringLength)
.collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append)
.toString();
}
public static Long generatingRandomLong() {
long leftLimit = 1L;
long rightLimit = 1000000L;
return leftLimit + (long) (Math.random() * (rightLimit - leftLimit));
}
public static int generatingRandomInteger() {
int leftLimit = 1;
int rightLimit = 9;
return leftLimit + (int) (new Random().nextFloat() * (rightLimit - leftLimit));
}
}

View file

@ -0,0 +1,48 @@
package ru.spcex.clearing.imdg.utils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.NotWritablePropertyException;
import org.springframework.beans.TypeMismatchException;
import org.springframework.jdbc.support.JdbcUtils;
import ru.spcex.platform.classes.base.SpcexObjectBase;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
public class SpcexObjectBaseRowMapper<T extends SpcexObjectBase> extends AbstractHistoryRowMapper<T> {
private final Class<T> mappedClass;
public SpcexObjectBaseRowMapper(Class<T> mappedClass) {
this.mappedClass = mappedClass;
}
@Override
public T mapRow(ResultSet rs, int rowNum) throws SQLException {
T object = BeanUtils.instantiateClass(this.mappedClass);
ResultSetMetaData meta_data = rs.getMetaData();
String objIdColumn = rs.getMetaData().getTableName(1).replace("_history", "_id");
int columnCount = meta_data.getColumnCount();
for (int index = 1; index <= columnCount; index++) {
String column = JdbcUtils.lookupColumnName(meta_data, index);
String fildName = getFildName(column, objIdColumn);
try {
Object value = JdbcUtils.getResultSetValue(rs, index, Class.forName(meta_data.getColumnClassName(index)));
if (fildName.equals("objId")) {
object.setId((Long) value);
continue;
}
setValueFildForObjectIfFildExists(object, object.getClass(), fildName, value);
} catch (TypeMismatchException | NotWritablePropertyException e) {
// Ignore
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
return object;
}
}

View file

@ -1,120 +0,0 @@
package ru.spcex.clearing.imdg.utils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.NotWritablePropertyException;
import org.springframework.beans.TypeMismatchException;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.support.JdbcUtils;
import ru.clearing.classes.objects.BusinessEvent;
import ru.spcex.platform.classes.base.SpcexObjectBase;
import java.lang.reflect.Field;
import java.sql.*;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.ZoneId;
import java.util.Date;
public class BusinessEventRowMapper<T extends BusinessEvent> implements RowMapper<T> {
private final Class<T> mappedClass;
public BusinessEventRowMapper(Class<T> mappedClass) {
this.mappedClass = mappedClass;
}
@Override
public T mapRow(ResultSet rs, int rowNum) throws SQLException {
T historyObject = BeanUtils.instantiateClass(this.mappedClass);
SpcexObjectBase objectFild = null;
try {
objectFild = (SpcexObjectBase) BeanUtils.instantiateClass(historyObject.getClass().getDeclaredField("object").getType());
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
}
ResultSetMetaData meta_data = rs.getMetaData();
String tableName = rs.getMetaData().getTableName(1);
tableName.replace("_history", "");
int columnCount = meta_data.getColumnCount();
for (int index = 1; index <= columnCount; index++) {
String column = JdbcUtils.lookupColumnName(meta_data, index);
String fildName = getFildName(column, tableName);
try {
Object value = JdbcUtils.getResultSetValue(rs, index, Class.forName(meta_data.getColumnClassName(index)));
setValueFildForObjectIfFildExists(historyObject, historyObject.getClass(), fildName, value);
setValueFildForObjectIfFildExists(objectFild, objectFild.getClass(), fildName, value);
} catch (TypeMismatchException | NotWritablePropertyException e) {
// Ignore
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
historyObject.setObject(objectFild);
return historyObject;
}
public void setValueFildForObjectIfFildExists(SpcexObjectBase object, Class<?> clazz, String fildName, Object value) {
try {
Field field = clazz.getDeclaredField(fildName);
field.setAccessible(true);
Class<?> typeField = field.getType();
if (typeField.equals(LocalDate.class)) {
Date date = (Date) value;
field.set(object, value != null ? Instant.ofEpochMilli(date.getTime()).atZone(ZoneId.systemDefault()).toLocalDate() : null);
} else if (typeField.equals(LocalTime.class)) {
Time time = (Time) value;
field.set(object, value != null ? time.toLocalTime() : null);
} else if (typeField.getName().equals(Instant.class.getName())) {
field.set(object, value != null ? ((Timestamp) value).toInstant() : null);
} else {
field.set(object, value);
}
} catch (NoSuchFieldException e) {
if (!clazz.getSuperclass().getName().equals(Object.class.getName())) {
setValueFildForObjectIfFildExists(object, clazz.getSuperclass(), fildName, value);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
private String getFildName(String str, String tableName) {
if (str.startsWith(tableName)) {
return "id";
} else if (str.equals("created_at")) {
return "created";
} else if (str.equals("updated_at")) {
return "updated";
} else if (str.equals("event_user_id")) {
return "userId";
}
return snakeToCamel(str);
}
private String snakeToCamel(String str) {
StringBuilder builder = new StringBuilder(str);
// Traverse the string character by
// character and remove underscore
// and capitalize next letter
for (int i = 0; i < builder.length(); i++) {
// Check char is underscore
if (builder.charAt(i) == '_') {
builder.deleteCharAt(i);
builder.replace(
i, i + 1,
String.valueOf(
Character.toUpperCase(
builder.charAt(i))));
}
}
// Return in String type
return builder.toString();
}
}

View file

@ -55,7 +55,7 @@ public final class IMDGDistributedNames {
public static final String Map_SDf09 = "Map_SDf09";
public static final String Map_SDf12 = "Map_SDf12";
public static final String Map_SDf18 = "Map_SDf18";
// public static final String Map_InterestStatusDictionary = "Map_InterestStatusDictionary"; future
public static final String Map_InterestStatusDictionary = "Map_InterestStatusDictionary";
public static final String Map_AllowedDictionary = "Map_AllowedDictionary";
// public static final String Map_ClearingMemberCategoryDictionary = "Map_ClearingMemberCategoryDictionary"; future
public static final String Map_CompanyRoleDictionary = "Map_CompanyRoleDictionary";

View file

@ -6,11 +6,12 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.InstantDeserializer;
import ru.spcex.clearing.platform.messaging.domain.json.serialize.InstantSerializer;
import java.math.BigDecimal;
import java.time.Instant;
public class KeyRateNewRequest {
@JsonProperty
public Double keyRate;
public BigDecimal keyRate;
@JsonSerialize(using = InstantSerializer.class)
@JsonDeserialize(using = InstantDeserializer.class)
@JsonProperty
@ -22,11 +23,11 @@ public class KeyRateNewRequest {
@JsonProperty
public String document;
public Double getKeyRate() {
public BigDecimal getKeyRate() {
return keyRate;
}
public void setKeyRate(Double keyRate) {
public void setKeyRate(BigDecimal keyRate) {
this.keyRate = keyRate;
}

View file

@ -6,13 +6,14 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.InstantDeserializer;
import ru.spcex.clearing.platform.messaging.domain.json.serialize.InstantSerializer;
import java.math.BigDecimal;
import java.time.Instant;
public class KeyRateUpdateRequest {
@JsonProperty
public Long id;
@JsonProperty
public Double keyRate;
public BigDecimal keyRate;
@JsonSerialize(using = InstantSerializer.class)
@JsonDeserialize(using = InstantDeserializer.class)
@JsonProperty
@ -32,11 +33,11 @@ public class KeyRateUpdateRequest {
this.id = id;
}
public Double getKeyRate() {
public BigDecimal getKeyRate() {
return keyRate;
}
public void setKeyRate(Double keyRate) {
public void setKeyRate(BigDecimal keyRate) {
this.keyRate = keyRate;
}